diff --git a/examples/routers/select.vue b/examples/routers/select.vue index 89fe550..dd3143d 100644 --- a/examples/routers/select.vue +++ b/examples/routers/select.vue @@ -1,50 +1,59 @@ <template> - <Row> - <Col span="12" style="padding-right:10px"> - <Select v-model="model11" :disabled="false" filterable> - <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> - </Select> - </Col> - <Col span="12"> - <Select v-model="model12" filterable :disabled="true" multiple> - <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> - </Select> - </Col> - </Row> + <div> + <h4>有remote属性</h4> + {{ selectedIds }} + <i-select remote clearable filterable multiple :label="selectedLabel" v-model="selectedIds" style='margin-bottom:20px;'> + <i-option v-for="option in list" :value="option.id" :key="option.id">{{option.name}}</i-option> + </i-select> + <i-button @click="setVal3">设置3</i-button> + </div> </template> <script> export default { data () { return { - cityList: [ - { - value: 'beijing', - label: '北京市' - }, - { - value: 'shanghai', - label: '上海市' - }, - { - value: 'shenzhen', - label: '深圳市' - }, - { - value: 'hangzhou', - label: '杭州市' - }, - { - value: 'nanjing', - label: '南京市' - }, - { - value: 'chongqing', - label: '重庆市' - } - ], - model11: '', - model12: [] + list: [], + selectedIds: [], + selectedLabel: [] } + }, + methods: { + setVal1: function () { + this.selectedLabel = ['几何', '化学']; + this.selectedIds = ['201701041343', '201701011541'] + + }, + setVal2: function () { + this.selectedLabel = ['政治', '英语', '数学']; + this.selectedIds = ['201701031442', '201701061244', '201701011145'] + }, + setVal3: function () { + this.selectedLabel = []; + this.selectedIds = []; + } + }, + mounted () { + setTimeout(() => { + this.list = [{ + name: '语文', + id: '201701011046' + }, { + name: '数学', + id: '201701011145' + }, { + name: '英语', + id: '201701061244' + }, { + name: '几何', + id: '201701041343' + }, { + name: '政治', + id: '201701031442' + }, { + name: '化学', + id: '201701011541' + }] + }, 1000) } } </script> diff --git a/src/components/select/select.vue b/src/components/select/select.vue index 069e374..3d953c9 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -639,6 +639,8 @@ label: this.currentLabel[index] }; }); + } else if (this.multiple && !this.model.length) { + this.selectedMultiple = []; } } } -- libgit2 0.21.4