Commit ed511e92 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Tree & Breadcrumb: fix setAttribute to undefined bug

parent f24aeeca
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
mounted() { mounted() {
const items = this.$el.querySelectorAll('.el-breadcrumb__item'); 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> </script>
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
checkedItem[0].setAttribute('tabindex', 0); checkedItem[0].setAttribute('tabindex', 0);
return; return;
} }
this.treeItems[0].setAttribute('tabindex', 0); this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
}, },
handelKeydown(ev) { handelKeydown(ev) {
const currentItem = ev.target; const currentItem = ev.target;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment