mirror of https://github.com/ElemeFE/element
Breadcrumb: use provide/inject instead of this.this.$parent
parent
38e320b8cc
commit
c8477c815a
|
@ -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;
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue