feat: 更新自定义切换组件,重命名为 headlessui-switch 并调整类型定义

This commit is contained in:
严浩
2024-11-21 14:35:44 +08:00
parent 213aac2d3c
commit da379a71eb
3 changed files with 7 additions and 9 deletions

View File

@@ -6,9 +6,9 @@ declare module '@formkit/inputs' {
// https://formkit.com/essentials/custom-inputs#typescript-support
interface FormKitInputProps<Props extends FormKitInputs<Props>> {
// This key and the `type` should match:
'mytoggle': {
'headlessui-switch': {
// Define your input `type`:
type: 'mytoggle',
type: 'headlessui-switch',
someProp: string,
}
}
@@ -21,9 +21,7 @@ declare module '@formkit/inputs' {
import { Switch, SwitchGroup, SwitchLabel } from '@headlessui/vue';
import { computed } from 'vue';
const props = defineProps<{
context: FormKitFrameworkContext;
}>();
const props = defineProps<{ context: FormKitFrameworkContext; }>();
const value = computed({

View File

@@ -148,7 +148,7 @@ onMounted(() => {
<FormKit
label="headlessui"
type="mytoggle"
type="headlessui-switch"
/>
<FormKit