Merge pull request #3254 from xiaofengsha/pr002
采用 findComponentUpward 替代 this.$parent.$parent.$parent 获取 Dropdown 父节点组件
This commit is contained in:
commit
a1a1e0c73e
1 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
const prefixCls = 'ivu-dropdown-item';
|
const prefixCls = 'ivu-dropdown-item';
|
||||||
|
import { findComponentUpward } from '../../utils/assist';
|
||||||
export default {
|
export default {
|
||||||
name: 'DropdownItem',
|
name: 'DropdownItem',
|
||||||
props: {
|
props: {
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClick () {
|
handleClick () {
|
||||||
const $parent = this.$parent.$parent.$parent;
|
const $parent = findComponentUpward(this, 'Dropdown');
|
||||||
const hasChildren = this.$parent && this.$parent.$options.name === 'Dropdown';
|
const hasChildren = this.$parent && this.$parent.$options.name === 'Dropdown';
|
||||||
|
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue