Commit 2f0b086d60516534003522c202142826db4c2eba

Authored by 梁灏
1 parent e8ee1423

fixed #116

fixed #116
Showing 2 changed files with 25 additions and 5 deletions   Show diff stats
src/components/select/select.vue
... ... @@ -459,6 +459,10 @@
459 459 slotChange () {
460 460 this.options = [];
461 461 this.optionInstances = [];
  462 + },
  463 + setQuery (query) {
  464 + if (!this.filterable) return;
  465 + this.query = query;
462 466 }
463 467 },
464 468 ready () {
... ...
test/routers/select.vue
1 1 <template>
2   - <i-button @click="model8 = ''">clear</i-button>
3   - <i-select :model.sync="model8" clearable style="width:200px">
4   - <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
5   - </i-select>
  2 + <i-button @click="clear">clear</i-button>
  3 + <Row>
  4 + <i-col span="12" style="padding-right:10px">
  5 + <i-select :model.sync="model11" filterable v-ref:select clearable>
  6 + <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
  7 + </i-select>
  8 + </i-col>
  9 + <i-col span="12">
  10 + <i-select :model.sync="model12" filterable multiple>
  11 + <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
  12 + </i-select>
  13 + </i-col>
  14 + </Row>
6 15 </template>
7 16 <script>
8 17 export default {
... ... @@ -34,7 +43,14 @@
34 43 label: '重庆市'
35 44 }
36 45 ],
37   - model8: ''
  46 + model11: '',
  47 + model12: []
  48 + }
  49 + },
  50 + methods: {
  51 + clear () {
  52 +// this.$refs.select.setQuery('');
  53 + this.$refs.select.clearSingleSelect();
38 54 }
39 55 }
40 56 }
... ...