Commit f4c38b4604d1328a53a41a39300a5da5842c9ec4
1 parent
bb1f58e2
fixed #805
Showing
2 changed files
with
28 additions
and
7 deletions
Show diff stats
examples/routers/select.vue
| 1 | <template> | 1 | <template> |
| 2 | <div style="width: 200px;margin: 100px;"> | 2 | <div style="width: 200px;margin: 100px;"> |
| 3 | - <Select v-model="fields.pid" filterable placement="top"> | ||
| 4 | - <Option :value="0" label="一级菜单"></Option> | ||
| 5 | - <Option :value="1" label="二级菜单"></Option> | ||
| 6 | - </Select> | 3 | + <i-select v-model="model" filterable clearable style="width:200px"> |
| 4 | + <i-option :value="option.value" v-for="option in options" :key="option">{{option.label}}</i-option> | ||
| 5 | + </i-select> | ||
| 7 | </div> | 6 | </div> |
| 8 | </template> | 7 | </template> |
| 9 | 8 | ||
| @@ -11,10 +10,26 @@ | @@ -11,10 +10,26 @@ | ||
| 11 | export default { | 10 | export default { |
| 12 | data () { | 11 | data () { |
| 13 | return { | 12 | return { |
| 14 | - fields: { | ||
| 15 | - pid: 0 | ||
| 16 | - } | 13 | + model: 1, |
| 14 | + options: [ | ||
| 15 | + | ||
| 16 | + ] | ||
| 17 | } | 17 | } |
| 18 | + }, | ||
| 19 | + mounted () { | ||
| 20 | + this.options = [{ | ||
| 21 | + label: '全部', | ||
| 22 | + value: 0 | ||
| 23 | + },{ | ||
| 24 | + label: '苹果', | ||
| 25 | + value: 1 | ||
| 26 | + },{ | ||
| 27 | + label: '香蕉', | ||
| 28 | + value: 2 | ||
| 29 | + },{ | ||
| 30 | + label: '西瓜', | ||
| 31 | + value: 3 | ||
| 32 | + }]; | ||
| 18 | } | 33 | } |
| 19 | } | 34 | } |
| 20 | </script> | 35 | </script> |
| 21 | \ No newline at end of file | 36 | \ No newline at end of file |
src/components/select/select.vue
| @@ -536,11 +536,17 @@ | @@ -536,11 +536,17 @@ | ||
| 536 | 536 | ||
| 537 | this.$on('append', () => { | 537 | this.$on('append', () => { |
| 538 | this.modelToQuery(); | 538 | this.modelToQuery(); |
| 539 | + this.$nextTick(() => { | ||
| 540 | + this.broadcastQuery(''); | ||
| 541 | + }); | ||
| 539 | this.slotChange(); | 542 | this.slotChange(); |
| 540 | this.updateOptions(true, true); | 543 | this.updateOptions(true, true); |
| 541 | }); | 544 | }); |
| 542 | this.$on('remove', () => { | 545 | this.$on('remove', () => { |
| 543 | this.modelToQuery(); | 546 | this.modelToQuery(); |
| 547 | + this.$nextTick(() => { | ||
| 548 | + this.broadcastQuery(''); | ||
| 549 | + }); | ||
| 544 | this.slotChange(); | 550 | this.slotChange(); |
| 545 | this.updateOptions(true, true); | 551 | this.updateOptions(true, true); |
| 546 | }); | 552 | }); |