<u-picker :columns="columns" @confirm="pickerConfirm" :show="pickerShow" @cancel="pickerShow = false" keyName="label"></u-picker>
下拉的数据是用:columns = "columns"
handleMatterEnum() {
getDictionaryList("SearchMatter").then((res) => {
let tempMatter = res.data
.filter((v) => v.parentId == "" && v.code !== "SearchMatter")
.map((item) => ({
id: item.code,
label: item.text,
}));
//注意这里的this.columns 是[[]] 这种结构的
this.columns = [tempMatter];
});
this.pickerShow = true;
},
image.png
2点击确定触发的事件
pickerConfirm(e) {
// 点击确定
console.log("点击确定", e);
if (e.value.length) {
this.searchForm.searchMatterEnumCode = e.value[0].id;
this.searchForm.searchMatterEnumName = e.value[0].label;
}
this.pickerShow = false;
},
网友评论