VUE ELEMENT UI 清空select 下拉选项
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
VUE ELEMENT UI 清空select 下拉选项
1.select代码
<el-form ref="searchForm" :inline="true" :model="searchForm" label-width="80px">
<el-form-item label="设备类别" prop="equipmentType">
<el-select v-model="searchForm.equipmentType.code" clearable @change="getEquipment($event)">
<el-option v-for="(item, index) in equipmentTypeList" :key="index" :label="item.desc" :value="item.code"></el-option>
</el-select>
</el-form-item>
<el-form-item label="细分类别" prop="equipmentDescType">
<el-select v-model="searchForm.equipmentDescType.code" clearable>
<el-option v-for="(item, index) in equipmentDescTypeList" :key="index" :label="item.desc" :value="item.code"></el-option>
</el-select>
</el-form-item>
</el-form>
2.JS代码
vm.searchForm.equipmentDescType.code = ‘’;
async getEquipment(event){
const vm = this;
vm.dictSearch.dictCodes = [];
// 清空下拉框
vm.searchForm.equipmentDescType.code = '';
vm.dictSearch.dictCodes.push(event);
const res = await comApiList.dictionaryItemList(vm.dictSearch);
if (res.data.code === 0) {
const data = res.data.data;
if (data) {
vm.equipmentDescTypeList = data[event];
}
} else {
vm.$message({
message: res.data.msg,
type: "error"
});
}
}
3.最后测试一下
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献5条内容
所有评论(0)