diff --git a/src/plugins/crud/components/switch/index.tsx b/src/plugins/crud/components/switch/index.tsx index 9cbf59c..48b9257 100644 --- a/src/plugins/crud/components/switch/index.tsx +++ b/src/plugins/crud/components/switch/index.tsx @@ -36,14 +36,18 @@ export default defineComponent({ watch( () => props.modelValue, (val) => { - if (isBoolean(props.modelValue)) { - activeValue.value = true; - inactiveValue.value = false; + // 首次获取类型 + if (activeValue.value === undefined) { + if (isBoolean(props.modelValue)) { + activeValue.value = true; + inactiveValue.value = false; + } else { + activeValue.value = props.activeValue; + inactiveValue.value = props.inactiveValue; + } } - nextTick(() => { - status.value = val; - }); + status.value = val; }, { immediate: true diff --git a/src/plugins/crud/config.ts b/src/plugins/crud/config.ts index 438b573..2922283 100644 --- a/src/plugins/crud/config.ts +++ b/src/plugins/crud/config.ts @@ -13,8 +13,8 @@ export default (): Merge => { label: "CRUD", description: "快速增删改查及一系列辅助组件", author: "COOL", - version: "1.0.2", - updateTime: "2024-02-19", + version: "1.0.3", + updateTime: "2024-02-20", demo: "/demo/crud", // 组件全注册