// ts 文件
export const columns: BasicColumn[] = [
{
field: "title",
component: "ApiSelect",
label: "标题",
colProps: { span: 11 },
itemProps: { validateTrigger: "blur" },
componentProps: ({ formModel }) => {
return {
api: myApi,
params: { page: 1, pageSize: 20000 },
labelField: "name",
valueField: "id",
showSearch: true,
optionFilterProp: "id",
resultField: "records",
// change 事件
onChange: (val, selectNode) => {
if (selectNode) {
// change 后要做的处理
}
},
// 清除内容事件
onDoClear: () => {
// 清除内容后要做的处理
},
};
},
},
];
ApiSelect.vue 文件
增加@clear 即可
<template>
<Select @clear="doClear"></Select>
</template>
<script lang="ts">
export default defineComponent({
emits: ['doClear'],
const doClear = () => {
emit('doClear');
};
})
return {
doClear,
};
</script>