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 | 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 | 6 | </template> |
| 7 | + | |
| 15 | 8 | <script> |
| 16 | 9 | export default { |
| 17 | 10 | data () { |
| 18 | 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 | 18 | -</script> |
| 19 | +</script> | |
| 51 | 20 | \ No newline at end of file | ... | ... |
src/components/cascader/caspanel.vue
| ... | ... | @@ -56,7 +56,7 @@ |
| 56 | 56 | handleTriggerItem (item, fromInit = false) { |
| 57 | 57 | if (item.disabled) return; |
| 58 | 58 | |
| 59 | - // return value back recursion | |
| 59 | + // return value back recursion // 向上递归,设置临时选中值(并非真实选中) | |
| 60 | 60 | const backItem = this.getBaseItem(item); |
| 61 | 61 | this.tmpItem = backItem; |
| 62 | 62 | this.emitUpdate([backItem]); | ... | ... |
src/components/select/select.vue
| ... | ... | @@ -493,7 +493,7 @@ |
| 493 | 493 | this.query = query; |
| 494 | 494 | }, |
| 495 | 495 | modelToQuery() { |
| 496 | - if (!this.multiple && this.filterable && this.model) { | |
| 496 | + if (!this.multiple && this.filterable && this.model !== undefined) { | |
| 497 | 497 | this.findChild((child) => { |
| 498 | 498 | if (this.model === child.value) { |
| 499 | 499 | if (child.label) { |
| ... | ... | @@ -518,6 +518,9 @@ |
| 518 | 518 | }, |
| 519 | 519 | mounted () { |
| 520 | 520 | this.modelToQuery(); |
| 521 | + this.$nextTick(() => { | |
| 522 | + this.broadcastQuery(''); | |
| 523 | + }); | |
| 521 | 524 | |
| 522 | 525 | this.updateOptions(true); |
| 523 | 526 | document.addEventListener('keydown', this.handleKeydown); | ... | ... |