Breadcrumb: use provide/inject instead of this.this.$parent

pull/8063/head
Pan 2017-11-06 12:50:08 +08:00 committed by 杨奕
parent 38e320b8cc
commit c8477c815a
2 changed files with 12 additions and 2 deletions

View File

@ -20,9 +20,12 @@
separatorClass: ''
};
},
inject: ['elBreadcrumb'],
mounted() {
this.separator = this.$parent.separator;
this.separatorClass = this.$parent.separatorClass;
this.separator = this.elBreadcrumb.separator;
this.separatorClass = this.elBreadcrumb.separatorClass;
let self = this;
if (this.to) {
let link = this.$refs.link;

View File

@ -17,6 +17,13 @@
default: ''
}
},
provide() {
return {
elBreadcrumb: this
};
},
mounted() {
const items = this.$el.querySelectorAll('.el-breadcrumb__item');
items[items.length - 1].setAttribute('aria-current', 'page');