vue+element-ui做的前端模糊查询
template模板代码:
<el-select
v-model="selectedValue"
@change="handleSelect"
filterable
placeholder="请搜索选择信号名称"
:filter-method="remoteMethod">
<el-option
v-for="item in options"
:key="item.id"
:label="item.signalName"
:value="item.seqNo">
</el-option>
</el-select>
data里面定义
signalList:[],
options: [],
selectedValue: '',
methods方法:
remoteMethod(query) {
if (query !== '') {
this.loading = true;
setTimeout(() => {
this.loading = false;
this.options = this.signalList.filter(item => {
return item.signalName.toLowerCase()
.indexOf(query.toLowerCase()) > -1;
});
}, 200);
} else {
this.options = [];
this.selectedValue = '';
}
},
原文地址:https://blog.csdn.net/hongyu799/article/details/145139050
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!