This commit is contained in:
2025-04-23 19:48:47 +08:00
parent 86aa66800c
commit fbfd175258
12 changed files with 469 additions and 112 deletions

View File

@@ -0,0 +1,39 @@
<script setup>
import {computed} from "vue";
import {Message} from "@arco-design/web-vue";
const {api, id} = defineProps({
api: {
type: Function,
default: async () => {
}
},
id: {
type: Number,
default: null,
}
});
const emits = defineEmits(['change']);
const modelValue = defineModel('model-value');
const status = computed({
get: () => Boolean(Number(modelValue.value)),
set: (value) => {
modelValue.value = value ? 1 : 0;
},
})
const change = async () => {
const {msg} = await api(id);
Message.success(msg);
emits('change');
}
</script>
<template>
<a-switch v-bind="$attrs" v-model:model-value="status" @change="change"></a-switch>
</template>
<style scoped lang="scss">
</style>