1、文档说明

https://cn.vuejs.org/v2/api/#provide-inject

2、实例

element ui的dropdown组件

dropdown.vue:

provide() {
return {
dropdown: this
};
}

dropdown-menu.vue

data() {
return {
size: this.dropdown.dropdownSize
};
}, inject: ['dropdown'],
05-11 20:53