Commit d94d98c464937eb3601e4415d3aaf12aae432c5b
1 parent
fa0241a5
fixed #215
fixed #215
Showing
2 changed files
with
42 additions
and
16 deletions
Show diff stats
src/components/select/option.vue
| ... | ... | @@ -55,7 +55,8 @@ |
| 55 | 55 | this.isFocus = false; |
| 56 | 56 | }, |
| 57 | 57 | queryChange (val) { |
| 58 | - this.hidden = !new RegExp(val, 'i').test(this.searchLabel); | |
| 58 | + const parsedQuery = val.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1'); | |
| 59 | + this.hidden = !new RegExp(parsedQuery, 'i').test(this.searchLabel); | |
| 59 | 60 | } |
| 60 | 61 | }, |
| 61 | 62 | compiled () { | ... | ... |
test/routers/select.vue
| 1 | 1 | <template> |
| 2 | - <i-select :model.sync="model9" style="width:200px"> | |
| 3 | - <i-option value="beijing" label="北京市"> | |
| 4 | - <span>北京</span> | |
| 5 | - <span style="float:right;color:#ccc">Beiing</span> | |
| 6 | - </i-option> | |
| 7 | - <i-option value="shanghai" label="上海市"> | |
| 8 | - <span>上海</span> | |
| 9 | - <span style="float:right;color:#ccc">ShangHai</span> | |
| 10 | - </i-option> | |
| 11 | - <i-option value="shenzhen" label="深圳市"> | |
| 12 | - <span>深圳</span> | |
| 13 | - <span style="float:right;color:#ccc">ShenZhen</span> | |
| 14 | - </i-option> | |
| 15 | - </i-select> | |
| 2 | + <Row> | |
| 3 | + <i-col span="12" style="padding-right:10px"> | |
| 4 | + <i-select :model.sync="model11" filterable> | |
| 5 | + <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option> | |
| 6 | + </i-select> | |
| 7 | + </i-col> | |
| 8 | + <i-col span="12"> | |
| 9 | + <i-select :model.sync="model12" filterable multiple> | |
| 10 | + <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option> | |
| 11 | + </i-select> | |
| 12 | + </i-col> | |
| 13 | + </Row> | |
| 16 | 14 | </template> |
| 17 | 15 | <script> |
| 18 | 16 | export default { |
| 19 | 17 | data () { |
| 20 | 18 | return { |
| 21 | - model9: 'shanghai' | |
| 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: [] | |
| 22 | 47 | } |
| 23 | 48 | } |
| 24 | 49 | } | ... | ... |