Commit a1a1e0c73eb30095536521cf2c3ff6f8ef3f36c4

Authored by Aresn
Committed by GitHub
2 parents bd0c5590 9b7e32b5

Merge pull request #3254 from xiaofengsha/pr002

采用 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) {
... ...