Commit 540e839c8b1605c3ef532c4c363db5d3cfda93ff
Committed by
GitHub
Merge pull request #179 from rijn/178
fixed #178
Showing
2 changed files
with
13 additions
and
17 deletions
Show diff stats
src/components/select/select.vue
| ... | ... | @@ -447,7 +447,7 @@ |
| 447 | 447 | if (model !== '') { |
| 448 | 448 | this.findChild((child) => { |
| 449 | 449 | if (child.value === model) { |
| 450 | - this.query = child.searchLabel; | |
| 450 | + this.query = child.label === undefined ? child.searchLabel : child.label; | |
| 451 | 451 | } |
| 452 | 452 | }); |
| 453 | 453 | } |
| ... | ... | @@ -574,7 +574,7 @@ |
| 574 | 574 | if (this.filterable) { |
| 575 | 575 | this.findChild((child) => { |
| 576 | 576 | if (child.value === value) { |
| 577 | - this.query = child.searchLabel; | |
| 577 | + this.query = child.label === undefined ? child.searchLabel : child.label; | |
| 578 | 578 | } |
| 579 | 579 | }); |
| 580 | 580 | } | ... | ... |
test/routers/select.vue
| ... | ... | @@ -2,12 +2,12 @@ |
| 2 | 2 | <Row> |
| 3 | 3 | <i-col span="12" style="padding-right:10px"> |
| 4 | 4 | <i-select :model.sync="model11" filterable> |
| 5 | - <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option> | |
| 5 | + <i-option v-for="item in cityList" :value="item.value" :label="item.label"><span>{{ item.label }}</span><span>{{ item.des }}</span></i-option> | |
| 6 | 6 | </i-select> |
| 7 | 7 | </i-col> |
| 8 | 8 | <i-col span="12"> |
| 9 | 9 | <i-select :model.sync="model12" filterable multiple> |
| 10 | - <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option> | |
| 10 | + <i-option v-for="item in cityList" :value="item.value" :label="item.label"><span>{{ item.label }}</span><span>{{ item.des }}</span></i-option> | |
| 11 | 11 | </i-select> |
| 12 | 12 | </i-col> |
| 13 | 13 | </Row> |
| ... | ... | @@ -19,30 +19,26 @@ |
| 19 | 19 | cityList: [ |
| 20 | 20 | { |
| 21 | 21 | value: 'beijing', |
| 22 | - label: '北京市' | |
| 22 | + label: '北京市', | |
| 23 | + des: '帝都' | |
| 23 | 24 | }, |
| 24 | 25 | { |
| 25 | 26 | value: 'shanghai', |
| 26 | - label: '上海市' | |
| 27 | + label: '上海市', | |
| 28 | + des: '魔都' | |
| 27 | 29 | }, |
| 28 | 30 | { |
| 29 | 31 | value: 'shenzhen', |
| 30 | - label: '深圳市' | |
| 31 | - }, | |
| 32 | - { | |
| 33 | - value: 'hangzhou', | |
| 34 | - label: '杭州市' | |
| 35 | - }, | |
| 36 | - { | |
| 37 | - value: 'nanjing', | |
| 38 | - label: '南京市' | |
| 32 | + label: '深圳市', | |
| 33 | + des: '渔村' | |
| 39 | 34 | }, |
| 40 | 35 | { |
| 41 | 36 | value: 'chongqing', |
| 42 | - label: '重庆市' | |
| 37 | + label: '重庆市', | |
| 38 | + des: '山城' | |
| 43 | 39 | } |
| 44 | 40 | ], |
| 45 | - model11: 'beijing', | |
| 41 | + model11: '', | |
| 46 | 42 | model12: ['beijing', 'shanghai'] |
| 47 | 43 | } |
| 48 | 44 | } | ... | ... |