Commit 9b7e32b507e016a589850e71498b1feb38368cb9

Authored by BillyWang
1 parent d45d2ee0

采用 findComponentUpward 替代 this.$parent.$parent.$parent 获取 Dropdown 父节点组件

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
src/components/dropdown/dropdown-item.vue
... ... @@ -3,7 +3,7 @@
3 3 </template>
4 4 <script>
5 5 const prefixCls = 'ivu-dropdown-item';
6   -
  6 + import { findComponentUpward } from '../../utils/assist';
7 7 export default {
8 8 name: 'DropdownItem',
9 9 props: {
... ... @@ -37,7 +37,7 @@
37 37 },
38 38 methods: {
39 39 handleClick () {
40   - const $parent = this.$parent.$parent.$parent;
  40 + const $parent = findComponentUpward(this, 'Dropdown');
41 41 const hasChildren = this.$parent && this.$parent.$options.name === 'Dropdown';
42 42  
43 43 if (this.disabled) {
... ...