🎨chore: 使用 oxlint, oxfmt&格式化代码

This commit is contained in:
2026-02-08 21:16:25 +08:00
parent 9d35c6a9d8
commit 3a801ba016
78 changed files with 3367 additions and 1468 deletions

View File

@@ -1,21 +1,21 @@
<script setup lang="ts">
import type {PropType} from "vue";
import type { PropType } from 'vue'
const emit = defineEmits(['input', 'change', 'update:modelValue'])
const props = defineProps({
modelValue: {
type: Boolean,
required: false
required: false,
},
size: {
type: String as PropType<'sm' | 'md' | 'lg'>,
required: false,
default: 'md'
default: 'md',
},
value: {
type: Boolean,
required: false
required: false,
},
onIcon: {
type: String,
@@ -24,7 +24,7 @@ const props = defineProps({
offIcon: {
type: String,
required: false,
}
},
})
const checked = ref(false)
@@ -88,31 +88,49 @@ onMounted(() => {
}
})
watch(() => props.modelValue, (value) => {
checked.value = value
})
watch(
() => props.modelValue,
(value) => {
checked.value = value
}
)
</script>
<template>
<button
class="relative flex items-center rounded-lg bg-neutral-100 dark:bg-neutral-800 shadow-inner transition ease-in-out group outline-none"
:class="{
class="relative flex items-center rounded-lg bg-neutral-100 dark:bg-neutral-800 shadow-inner transition ease-in-out group outline-none"
:class="{
'!bg-green-400 dark:!bg-green-400/50': checked,
[buttonSizeClass]: buttonSizeClass,
[buttonPaddingClass]: buttonPaddingClass
}" @click="handleCheck">
[buttonPaddingClass]: buttonPaddingClass,
}"
@click="handleCheck"
>
<span
class="aspect-[1/1] translate-x-0 transition ease-in-out bg-white dark:bg-black rounded-md shadow duration-300 group-active:scale-90"
:class="{
'!shadow-lg': checked,
'group-active:translate-x-3 group-active:duration-500': !checked,
[bulletSizeClass]: bulletSizeClass,
[bulletTranslateClass]: checked
}">
<span v-if="onIcon || offIcon" class="absolute inset-0 flex items-center justify-center text-neutral-400">
<Transition name="icon" mode="out-in">
<slot v-if="checked" name="on-icon"/>
<slot v-else name="off-icon"/>
class="aspect-[1/1] translate-x-0 transition ease-in-out bg-white dark:bg-black rounded-md shadow duration-300 group-active:scale-90"
:class="{
'!shadow-lg': checked,
'group-active:translate-x-3 group-active:duration-500': !checked,
[bulletSizeClass]: bulletSizeClass,
[bulletTranslateClass]: checked,
}"
>
<span
v-if="onIcon || offIcon"
class="absolute inset-0 flex items-center justify-center text-neutral-400"
>
<Transition
name="icon"
mode="out-in"
>
<slot
v-if="checked"
name="on-icon"
/>
<slot
v-else
name="off-icon"
/>
</Transition>
</span>
</span>
@@ -130,4 +148,4 @@ watch(() => props.modelValue, (value) => {
opacity: 0;
transform: scale(0.5);
}
</style>
</style>