
html
<fui-select :show="showSiteType" :options="siteTypeList" textKey="dict_label" title="请选择站点类型"
@confirm="chooseSiteType" @close="onCloseSiteType">
<template v-slot:search>
<view>
<fui-search-bar background="#ffffff" inputBackground="#FAFAFA"
@search="searchSiteType"></fui-search-bar>
</view>
</template>
</fui-select>
javascript
const showSiteType = ref(false) //站点类型选择
// 站点类型
function getSiteTypeList(key) {
api.getSiteTypeList({
keyworld: key,
}).then(res => {
if (res.code == 200) {
console.log(res);
siteTypeList.value = res.data
}
})
}
function searchSiteType(e) {
let key = e.detail.value
getSiteTypeList(key)
}
function chooseSiteType(e) {
state.type_id = e.options.dict_value//站点类型id
state.typeIdName = e.options.dict_label//站点类型名称
onCloseSiteType()
}
function onCloseSiteType() {
showSiteType.value = false
}