Commit a5f4a1d4583dac421dfbb572a7ea867f07eee2e4
1 parent
6c634aa6
fixed #1922
Showing
2 changed files
with
4 additions
and
17 deletions
Show diff stats
examples/routers/cascader.vue
1 | 1 | <template> |
2 | 2 | <div style="width: 200px;margin: 100px;"> |
3 | - <Cascader :data="data" v-model="value1"></Cascader> | |
3 | + <Cascader :data="data" v-model="value1" trigger="hover"></Cascader> | |
4 | 4 | </div> |
5 | 5 | </template> |
6 | 6 | <script> |
... | ... | @@ -11,20 +11,7 @@ |
11 | 11 | data: [{ |
12 | 12 | value: 'beijing', |
13 | 13 | label: '北京', |
14 | - children: [ | |
15 | - { | |
16 | - value: 'gugong', | |
17 | - label: '故宫' | |
18 | - }, | |
19 | - { | |
20 | - value: 'tiantan', | |
21 | - label: '天坛' | |
22 | - }, | |
23 | - { | |
24 | - value: 'wangfujing', | |
25 | - label: '王府井' | |
26 | - } | |
27 | - ] | |
14 | + children: [] | |
28 | 15 | }, { |
29 | 16 | value: 'jiangsu', |
30 | 17 | label: '江苏', | ... | ... |
src/components/cascader/caspanel.vue
... | ... | @@ -49,11 +49,11 @@ |
49 | 49 | }, |
50 | 50 | methods: { |
51 | 51 | handleClickItem (item) { |
52 | - if (this.trigger !== 'click' && item.children) return; | |
52 | + if (this.trigger !== 'click' && item.children && item.children.length) return; // #1922 | |
53 | 53 | this.handleTriggerItem(item, false, true); |
54 | 54 | }, |
55 | 55 | handleHoverItem (item) { |
56 | - if (this.trigger !== 'hover' || !item.children) return; | |
56 | + if (this.trigger !== 'hover' || !item.children || !item.children.length) return; // #1922 | |
57 | 57 | this.handleTriggerItem(item, false, true); |
58 | 58 | }, |
59 | 59 | handleTriggerItem (item, fromInit = false, fromUser = false) { | ... | ... |