Commit f4c38b4604d1328a53a41a39300a5da5842c9ec4

Authored by 梁灏
1 parent bb1f58e2

fixed #805

examples/routers/select.vue
1 1 <template>
2 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 6 </div>
8 7 </template>
9 8  
... ... @@ -11,10 +10,26 @@
11 10 export default {
12 11 data () {
13 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 35 </script>
21 36 \ No newline at end of file
... ...
src/components/select/select.vue
... ... @@ -536,11 +536,17 @@
536 536  
537 537 this.$on('append', () => {
538 538 this.modelToQuery();
  539 + this.$nextTick(() => {
  540 + this.broadcastQuery('');
  541 + });
539 542 this.slotChange();
540 543 this.updateOptions(true, true);
541 544 });
542 545 this.$on('remove', () => {
543 546 this.modelToQuery();
  547 + this.$nextTick(() => {
  548 + this.broadcastQuery('');
  549 + });
544 550 this.slotChange();
545 551 this.updateOptions(true, true);
546 552 });
... ...