fixed #215
This commit is contained in:
梁灏 2017-01-17 12:13:18 +08:00
parent fa0241a535
commit d94d98c464
2 changed files with 42 additions and 16 deletions

View file

@ -55,7 +55,8 @@
this.isFocus = false;
},
queryChange (val) {
this.hidden = !new RegExp(val, 'i').test(this.searchLabel);
const parsedQuery = val.replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1');
this.hidden = !new RegExp(parsedQuery, 'i').test(this.searchLabel);
}
},
compiled () {

View file

@ -1,24 +1,49 @@
<template>
<i-select :model.sync="model9" style="width:200px">
<i-option value="beijing" label="北京市">
<span>北京</span>
<span style="float:right;color:#ccc">Beiing</span>
</i-option>
<i-option value="shanghai" label="上海市">
<span>上海</span>
<span style="float:right;color:#ccc">ShangHai</span>
</i-option>
<i-option value="shenzhen" label="深圳市">
<span>深圳</span>
<span style="float:right;color:#ccc">ShenZhen</span>
</i-option>
</i-select>
<Row>
<i-col span="12" style="padding-right:10px">
<i-select :model.sync="model11" filterable>
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
</i-col>
<i-col span="12">
<i-select :model.sync="model12" filterable multiple>
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
</i-col>
</Row>
</template>
<script>
export default {
data () {
return {
model9: 'shanghai'
cityList: [
{
value: 'beijing',
label: '北京市'
},
{
value: 'shanghai',
label: '上海市'
},
{
value: 'shenzhen',
label: '深圳市'
},
{
value: 'hangzhou',
label: '杭州市'
},
{
value: 'nanjing',
label: '南京市'
},
{
value: 'chongqing',
label: '重庆市'
}
],
model11: '',
model12: []
}
}
}