Commit f8098275cab5b520d1277df2b1e04f9170660c35
1 parent
6c912a7b
fixed #1547
Showing
2 changed files
with
17 additions
and
44 deletions
Show diff stats
examples/routers/select.vue
| 1 | <template> | 1 | <template> |
| 2 | - <i-select transfer multiple v-model="m1"> | ||
| 3 | - <i-option v-for="item in options" :value="item.value" :key="item.value">{{ item.label }}</i-option> | ||
| 4 | - </i-select> | 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> | ||
| 5 | </template> | 14 | </template> |
| 6 | <script> | 15 | <script> |
| 7 | export default { | 16 | export default { |
| 8 | data () { | 17 | data () { |
| 9 | return { | 18 | return { |
| 10 | - m1: [], | ||
| 11 | - showModal: false, | ||
| 12 | - showModal2: false, | ||
| 13 | - options: [ | 19 | + cityList: [ |
| 14 | { | 20 | { |
| 15 | value: 'beijing', | 21 | value: 'beijing', |
| 16 | label: '北京市' | 22 | label: '北京市' |
| @@ -35,43 +41,9 @@ | @@ -35,43 +41,9 @@ | ||
| 35 | value: 'chongqing', | 41 | value: 'chongqing', |
| 36 | label: '重庆市' | 42 | label: '重庆市' |
| 37 | } | 43 | } |
| 38 | - ] | ||
| 39 | - } | ||
| 40 | - }, | ||
| 41 | - methods: { | ||
| 42 | - remoteMethod1 (query) { | ||
| 43 | - if (query !== '') { | ||
| 44 | - this.loading1 = true; | ||
| 45 | - setTimeout(() => { | ||
| 46 | - this.loading1 = false; | ||
| 47 | - const list = this.list.map(item => { | ||
| 48 | - return { | ||
| 49 | - value: item, | ||
| 50 | - label: item | ||
| 51 | - }; | ||
| 52 | - }); | ||
| 53 | - this.options1 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); | ||
| 54 | - }, 200); | ||
| 55 | - } else { | ||
| 56 | - this.options1 = []; | ||
| 57 | - } | ||
| 58 | - }, | ||
| 59 | - remoteMethod2 (query) { | ||
| 60 | - if (query !== '') { | ||
| 61 | - this.loading2 = true; | ||
| 62 | - setTimeout(() => { | ||
| 63 | - this.loading2 = false; | ||
| 64 | - const list = this.list.map(item => { | ||
| 65 | - return { | ||
| 66 | - value: item, | ||
| 67 | - label: item | ||
| 68 | - }; | ||
| 69 | - }); | ||
| 70 | - this.options2 = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1); | ||
| 71 | - }, 200); | ||
| 72 | - } else { | ||
| 73 | - this.options2 = []; | ||
| 74 | - } | 44 | + ], |
| 45 | + model11: '', | ||
| 46 | + model12: [] | ||
| 75 | } | 47 | } |
| 76 | } | 48 | } |
| 77 | } | 49 | } |
src/components/select/select.vue
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | type="text" | 14 | type="text" |
| 15 | v-if="filterable" | 15 | v-if="filterable" |
| 16 | v-model="query" | 16 | v-model="query" |
| 17 | + :disabled="disabled" | ||
| 17 | :class="[prefixCls + '-input']" | 18 | :class="[prefixCls + '-input']" |
| 18 | :placeholder="showPlaceholder ? localePlaceholder : ''" | 19 | :placeholder="showPlaceholder ? localePlaceholder : ''" |
| 19 | :style="inputStyle" | 20 | :style="inputStyle" |