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: ''
|
separatorClass: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inject: ['elBreadcrumb'],
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.separator = this.$parent.separator;
|
this.separator = this.elBreadcrumb.separator;
|
||||||
this.separatorClass = this.$parent.separatorClass;
|
this.separatorClass = this.elBreadcrumb.separatorClass;
|
||||||
let self = this;
|
let self = this;
|
||||||
if (this.to) {
|
if (this.to) {
|
||||||
let link = this.$refs.link;
|
let link = this.$refs.link;
|
||||||
|
|
|
@ -17,6 +17,13 @@
|
||||||
default: ''
|
default: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
elBreadcrumb: this
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
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');
|
items[items.length - 1].setAttribute('aria-current', 'page');
|
||||||
|
|
Loading…
Reference in New Issue