mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 03:46:45 +08:00
30 lines
732 B
Vue
30 lines
732 B
Vue
<template>
|
|
<a-checkbox v-model:checked="checked" @change="change">
|
|
<slot></slot>
|
|
</a-checkbox>
|
|
</template>
|
|
<script setup>
|
|
import {defineEmits, defineProps, ref, watchEffect} from "vue";
|
|
|
|
const props = defineProps({
|
|
modelValue: {
|
|
type: [Boolean, Number, String],
|
|
default: false
|
|
},
|
|
checkValue: {
|
|
type: [Boolean, Number, String],
|
|
default: false
|
|
},
|
|
unCheckValue: {
|
|
type: [Boolean, Number, String],
|
|
default: true
|
|
},
|
|
});
|
|
const emit = defineEmits(["update:modelValue"]);
|
|
const checked = ref(props.modelValue);
|
|
watchEffect(() => checked.value = props.modelValue);
|
|
|
|
const change = ({ target: { checked } }) => emit("update:modelValue", checked ? props.checkValue : props.unCheckValue);
|
|
|
|
</script>
|