|
@@ -3,7 +3,7 @@
|
|
|
placeholder="状态"
|
|
|
allowClear
|
|
|
:disabled="props.disabled"
|
|
|
- :value="props.value"
|
|
|
+ :value="valueStr"
|
|
|
@change="handleChange"
|
|
|
style="width: 80px"
|
|
|
>
|
|
@@ -13,9 +13,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { computed } from "vue-demi";
|
|
|
+
|
|
|
const props = withDefaults(
|
|
|
defineProps<{
|
|
|
- value?: string;
|
|
|
+ value?: boolean;
|
|
|
disabled?: boolean;
|
|
|
}>(),
|
|
|
{
|
|
@@ -25,8 +27,14 @@ const props = withDefaults(
|
|
|
);
|
|
|
const emit = defineEmits(["update:value"]);
|
|
|
|
|
|
-function handleChange(v: string) {
|
|
|
+const valueStr = computed(() => {
|
|
|
+ let res: undefined | boolean | string = props.value ?? undefined;
|
|
|
+ if (typeof res === "boolean") res = props.value + "";
|
|
|
+ return res as undefined | string;
|
|
|
+});
|
|
|
+
|
|
|
+function handleChange(v: undefined | string) {
|
|
|
// console.log(v);
|
|
|
- emit("update:value", v);
|
|
|
+ emit("update:value", typeof v === "undefined" ? v : JSON.parse(v));
|
|
|
}
|
|
|
</script>
|