Tree & Breadcrumb: fix setAttribute to undefined bug

This commit is contained in:
Leopoldthecoder 2017-11-13 17:12:25 +08:00 committed by 杨奕
parent f24aeeca00
commit ed511e9219
2 changed files with 4 additions and 2 deletions

View File

@ -26,7 +26,9 @@
mounted() {
const items = this.$el.querySelectorAll('.el-breadcrumb__item');
items[items.length - 1].setAttribute('aria-current', 'page');
if (items.length) {
items[items.length - 1].setAttribute('aria-current', 'page');
}
}
};
</script>

View File

@ -194,7 +194,7 @@
checkedItem[0].setAttribute('tabindex', 0);
return;
}
this.treeItems[0].setAttribute('tabindex', 0);
this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
},
handelKeydown(ev) {
const currentItem = ev.target;