@@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { FormInstance } from "element-plus";
|
import type { FormInstance } from "element-plus";
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref, onMounted } from "vue";
|
||||||
|
|
||||||
// 对象类型
|
// 对象类型
|
||||||
type IObject = Record<string, any>;
|
type IObject = Record<string, any>;
|
||||||
@@ -91,6 +91,8 @@ export interface ISearchConfig {
|
|||||||
initialValue?: any;
|
initialValue?: any;
|
||||||
// 可选项(适用于select组件)
|
// 可选项(适用于select组件)
|
||||||
options?: { label: string; value: any }[];
|
options?: { label: string; value: any }[];
|
||||||
|
// 初始化数据函数扩展(适用初始化options)
|
||||||
|
initFn?: Function;
|
||||||
}>;
|
}>;
|
||||||
// 是否开启展开和收缩
|
// 是否开启展开和收缩
|
||||||
isExpandable?: boolean;
|
isExpandable?: boolean;
|
||||||
@@ -146,6 +148,12 @@ function toggleVisible() {
|
|||||||
visible.value = !visible.value;
|
visible.value = !visible.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
props.searchConfig.formItems.forEach((item) => {
|
||||||
|
item.initFn && item.initFn();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// 暴露的属性和方法
|
// 暴露的属性和方法
|
||||||
defineExpose({ getQueryParams, toggleVisible });
|
defineExpose({ getQueryParams, toggleVisible });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -57,10 +57,15 @@ const searchConfig: ISearchConfig = {
|
|||||||
width: "100px",
|
width: "100px",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [],
|
||||||
|
initFn() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.options = [
|
||||||
{ label: "启用", value: 1 },
|
{ label: "启用", value: 1 },
|
||||||
{ label: "禁用", value: 0 },
|
{ label: "禁用", value: 0 },
|
||||||
],
|
];
|
||||||
|
}, 300);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "date-picker",
|
type: "date-picker",
|
||||||
|
|||||||
Reference in New Issue
Block a user