Commit 60314959068776c38fe5d179aec3340f30802272
1 parent
36d58d07
fixed #1743 and close #1762
Showing
2 changed files
with
51 additions
and
40 deletions
Show diff stats
examples/routers/select.vue
| 1 | 1 | <template> |
| 2 | - <Row> | |
| 3 | - <Col span="12" style="padding-right:10px"> | |
| 4 | - <Select v-model="model11" :disabled="false" filterable> | |
| 5 | - <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> | |
| 6 | - </Select> | |
| 7 | - </Col> | |
| 8 | - <Col span="12"> | |
| 9 | - <Select v-model="model12" filterable :disabled="true" multiple> | |
| 10 | - <Option v-for="item in cityList" :value="item.value" :key="item.value">{{ item.label }}</Option> | |
| 11 | - </Select> | |
| 12 | - </Col> | |
| 13 | - </Row> | |
| 2 | + <div> | |
| 3 | + <h4>有remote属性</h4> | |
| 4 | + {{ selectedIds }} | |
| 5 | + <i-select remote clearable filterable multiple :label="selectedLabel" v-model="selectedIds" style='margin-bottom:20px;'> | |
| 6 | + <i-option v-for="option in list" :value="option.id" :key="option.id">{{option.name}}</i-option> | |
| 7 | + </i-select> | |
| 8 | + <i-button @click="setVal3">设置3</i-button> | |
| 9 | + </div> | |
| 14 | 10 | </template> |
| 15 | 11 | <script> |
| 16 | 12 | export default { |
| 17 | 13 | data () { |
| 18 | 14 | 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: [] | |
| 15 | + list: [], | |
| 16 | + selectedIds: [], | |
| 17 | + selectedLabel: [] | |
| 47 | 18 | } |
| 19 | + }, | |
| 20 | + methods: { | |
| 21 | + setVal1: function () { | |
| 22 | + this.selectedLabel = ['几何', '化学']; | |
| 23 | + this.selectedIds = ['201701041343', '201701011541'] | |
| 24 | + | |
| 25 | + }, | |
| 26 | + setVal2: function () { | |
| 27 | + this.selectedLabel = ['政治', '英语', '数学']; | |
| 28 | + this.selectedIds = ['201701031442', '201701061244', '201701011145'] | |
| 29 | + }, | |
| 30 | + setVal3: function () { | |
| 31 | + this.selectedLabel = []; | |
| 32 | + this.selectedIds = []; | |
| 33 | + } | |
| 34 | + }, | |
| 35 | + mounted () { | |
| 36 | + setTimeout(() => { | |
| 37 | + this.list = [{ | |
| 38 | + name: '语文', | |
| 39 | + id: '201701011046' | |
| 40 | + }, { | |
| 41 | + name: '数学', | |
| 42 | + id: '201701011145' | |
| 43 | + }, { | |
| 44 | + name: '英语', | |
| 45 | + id: '201701061244' | |
| 46 | + }, { | |
| 47 | + name: '几何', | |
| 48 | + id: '201701041343' | |
| 49 | + }, { | |
| 50 | + name: '政治', | |
| 51 | + id: '201701031442' | |
| 52 | + }, { | |
| 53 | + name: '化学', | |
| 54 | + id: '201701011541' | |
| 55 | + }] | |
| 56 | + }, 1000) | |
| 48 | 57 | } |
| 49 | 58 | } |
| 50 | 59 | </script> | ... | ... |