Commit 83b73885988cf62e29457e4161f4553712395c67
1 parent
59e1a7c6
fixed #718
Showing
4 changed files
with
15 additions
and
44 deletions
Show diff stats
examples/routers/collapse.vue
examples/routers/select.vue
1 | <template> | 1 | <template> |
2 | - <Row> | ||
3 | - <i-col span="12" style="padding-right:10px"> | ||
4 | - <Select v-model="model11" filterable> | ||
5 | - <Option v-for="item in cityList" :value="item.value" :key="item">{{ item.label }}</Option> | ||
6 | - </Select> | ||
7 | - </i-col> | ||
8 | - <i-col span="12"> | ||
9 | - <Select v-model="model12" filterable multiple> | ||
10 | - <Option v-for="item in cityList" :value="item.value" :key="item">{{ item.label }}</Option> | ||
11 | - </Select> | ||
12 | - </i-col> | ||
13 | - </Row> | 2 | + <Select v-model="fields.pid" filterable> |
3 | + <Option :value="0" label="一级菜单"></Option> | ||
4 | + <Option :value="1" label="二级菜单"></Option> | ||
5 | + </Select> | ||
14 | </template> | 6 | </template> |
7 | + | ||
15 | <script> | 8 | <script> |
16 | export default { | 9 | export default { |
17 | data () { | 10 | data () { |
18 | return { | 11 | return { |
19 | - cityList: [ | ||
20 | - { | ||
21 | - value: 'beijing', | ||
22 | - label: '北京市' | ||
23 | - }, | ||
24 | - { | ||
25 | - value: 'shanghai', | ||
26 | - label: '上海市' | ||
27 | - }, | ||
28 | - { | ||
29 | - value: 'shenzhen', | ||
30 | - label: '深圳市' | ||
31 | - }, | ||
32 | - { | ||
33 | - value: 'hangzhou', | ||
34 | - label: '杭州市' | ||
35 | - }, | ||
36 | - { | ||
37 | - value: 'nanjing', | ||
38 | - label: '南京市' | ||
39 | - }, | ||
40 | - { | ||
41 | - value: 'chongqing', | ||
42 | - label: '重庆市' | ||
43 | - } | ||
44 | - ], | ||
45 | - model11: '', | ||
46 | - model12: [] | 12 | + fields: { |
13 | + pid: 0 | ||
14 | + } | ||
47 | } | 15 | } |
48 | } | 16 | } |
49 | } | 17 | } |
50 | -</script> | 18 | -</script> |
19 | +</script> | ||
51 | \ No newline at end of file | 20 | \ No newline at end of file |
src/components/cascader/caspanel.vue
@@ -56,7 +56,7 @@ | @@ -56,7 +56,7 @@ | ||
56 | handleTriggerItem (item, fromInit = false) { | 56 | handleTriggerItem (item, fromInit = false) { |
57 | if (item.disabled) return; | 57 | if (item.disabled) return; |
58 | 58 | ||
59 | - // return value back recursion | 59 | + // return value back recursion // 向上递归,设置临时选中值(并非真实选中) |
60 | const backItem = this.getBaseItem(item); | 60 | const backItem = this.getBaseItem(item); |
61 | this.tmpItem = backItem; | 61 | this.tmpItem = backItem; |
62 | this.emitUpdate([backItem]); | 62 | this.emitUpdate([backItem]); |
src/components/select/select.vue
@@ -493,7 +493,7 @@ | @@ -493,7 +493,7 @@ | ||
493 | this.query = query; | 493 | this.query = query; |
494 | }, | 494 | }, |
495 | modelToQuery() { | 495 | modelToQuery() { |
496 | - if (!this.multiple && this.filterable && this.model) { | 496 | + if (!this.multiple && this.filterable && this.model !== undefined) { |
497 | this.findChild((child) => { | 497 | this.findChild((child) => { |
498 | if (this.model === child.value) { | 498 | if (this.model === child.value) { |
499 | if (child.label) { | 499 | if (child.label) { |
@@ -518,6 +518,9 @@ | @@ -518,6 +518,9 @@ | ||
518 | }, | 518 | }, |
519 | mounted () { | 519 | mounted () { |
520 | this.modelToQuery(); | 520 | this.modelToQuery(); |
521 | + this.$nextTick(() => { | ||
522 | + this.broadcastQuery(''); | ||
523 | + }); | ||
521 | 524 | ||
522 | this.updateOptions(true); | 525 | this.updateOptions(true); |
523 | document.addEventListener('keydown', this.handleKeydown); | 526 | document.addEventListener('keydown', this.handleKeydown); |