select val type변경
This commit is contained in:
@@ -15,8 +15,8 @@ const SelectBox = React.forwardRef<
|
||||
selectClass:string|undefined,
|
||||
className:string,
|
||||
selectArray:SelectBox1[],
|
||||
onSelectValue:(val:string)=>void,
|
||||
value?: string
|
||||
onSelectValue:(val:string|number)=>void,
|
||||
value?: string|number
|
||||
}
|
||||
>(({ label, className, selectClass, selectArray, onSelectValue, value }, ref)=>{
|
||||
const placeHolder = selectArray?.[0]?.text ?? "";
|
||||
@@ -24,13 +24,13 @@ const SelectBox = React.forwardRef<
|
||||
return (
|
||||
<div className={className+" flex items-center"} ref={ref}>
|
||||
{label && <Label className="w-20 text-base text-gray-600">{label}</Label>}
|
||||
<Select onValueChange={onSelectValue} value={value}>
|
||||
<Select onValueChange={onSelectValue} value={value !== undefined ? String(value) : undefined}>
|
||||
<SelectTrigger className={selectClass?selectClass:"flex-1 p-2 border rounded"}>
|
||||
<SelectValue placeholder={placeHolder} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{selectArray.map((selectArray) => (
|
||||
<SelectItem key={selectArray.val} value={selectArray.val}>{selectArray.text}</SelectItem>
|
||||
<SelectItem key={selectArray.val} value={String(selectArray.val)}>{selectArray.text}</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
Reference in New Issue
Block a user