mirror of
https://github.com/keven1024/015.git
synced 2026-06-10 06:14:34 +00:00
refactor(front): update field components to use RuleExpression for validation rules
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import FileUpload from '~/components/FileUpload.vue'
|
||||
import { cx } from 'class-variance-authority'
|
||||
|
||||
import type { RuleExpression } from 'vee-validate'
|
||||
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
rules?: string
|
||||
rules?: RuleExpression<File>
|
||||
}>()
|
||||
const { value, setValue } = useField<File>(props?.name, props?.rules)
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import Tiptap from '@/components/Tiptap.vue'
|
||||
|
||||
import type { RuleExpression } from 'vee-validate'
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
rules?: string
|
||||
rules?: RuleExpression<string>
|
||||
}>()
|
||||
const { value, } = useField<string>(props.name, props.rules)
|
||||
</script>
|
||||
|
||||
@@ -8,12 +8,13 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import type { RuleExpression } from 'vee-validate'
|
||||
type SelectValue = string | number
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
placeholder?: string
|
||||
label?: string
|
||||
rules?: string
|
||||
rules?: RuleExpression<SelectValue>
|
||||
options?: {
|
||||
label?: string
|
||||
value: SelectValue
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { Switch } from '@/components/ui/switch'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import type { RuleExpression } from 'vee-validate'
|
||||
const props = defineProps<{
|
||||
name: string
|
||||
label?: string
|
||||
rules?: string
|
||||
rules?: RuleExpression<boolean>
|
||||
}>()
|
||||
const { value } = useField<boolean>(props.name, props?.rules)
|
||||
</script>
|
||||
|
||||
@@ -3,8 +3,6 @@ import AsyncButton from '@/components/ui/button/AsyncButton.vue'
|
||||
const props = defineProps<{
|
||||
data: any
|
||||
}>()
|
||||
const router = useRouter()
|
||||
|
||||
|
||||
const handleDownload = async () => {
|
||||
const { id } = props?.data || {}
|
||||
|
||||
Reference in New Issue
Block a user