修复表单响应性问题 & 更新套餐管理接口字段
This commit is contained in:
@@ -7,13 +7,13 @@ import {Minus, Plus} from 'lucide-react'
|
||||
import FormOption from '@/components/composites/purchase/option'
|
||||
import Image from 'next/image'
|
||||
import check from '../_assets/check.svg'
|
||||
import {useFormContext} from 'react-hook-form'
|
||||
import {useFormContext, useWatch} from 'react-hook-form'
|
||||
import {Schema} from '@/components/composites/purchase/short/form'
|
||||
import {Card} from '@/components/ui/card'
|
||||
|
||||
export default function Center() {
|
||||
const form = useFormContext<Schema>()
|
||||
const type = form.watch('type')
|
||||
const type = useWatch({name: 'type'})
|
||||
|
||||
return (
|
||||
<Card className="flex-auto p-6 flex flex-col gap-6 relative">
|
||||
@@ -82,8 +82,8 @@ export default function Center() {
|
||||
theme="outline"
|
||||
type="button"
|
||||
className="h-10 w-10 border border-gray-200 rounded-sm flex items-center justify-center text-lg"
|
||||
onClick={() => form.setValue('quota', Math.max(10_000, Number(field.value) - 5_000))}
|
||||
disabled={Number(field.value) === 10_000}>
|
||||
onClick={() => form.setValue('quota', Math.max(10000, Number(field.value) - 5000))}
|
||||
disabled={Number(field.value) === 10000}>
|
||||
<Minus/>
|
||||
</Button>
|
||||
<Input
|
||||
@@ -91,14 +91,13 @@ export default function Center() {
|
||||
id={id}
|
||||
type="number"
|
||||
className="w-40 h-10 border border-gray-200 rounded-sm text-center"
|
||||
min={10_000}
|
||||
step={5_000}
|
||||
/>
|
||||
min={10000}
|
||||
step={5000}/>
|
||||
<Button
|
||||
theme="outline"
|
||||
type="button"
|
||||
className="h-10 w-10 border border-gray-200 rounded-sm flex items-center justify-center text-lg"
|
||||
onClick={() => form.setValue('quota', Number(field.value) + 5_000)}>
|
||||
onClick={() => form.setValue('quota', Number(field.value) + 5000)}>
|
||||
<Plus/>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user