import React, { createElement, useEffect, useState } from 'react'; import { Checkbox, Icon, Balloon, Input, Box, Switch } from '@alifd/next'; interface ItemProps { info: { label: string,value:string,link:any[] }; add: (label: { label: string,value:string,link:any[] }) => void; del: () => void; } const Item: React.FC = (props) => { const { info, add, del } = props; const [visible, setVisible] = useState(false); const [label,setLabel] = useState(info.label) const [value,setVallue] = useState(info.value) const [link] = useState(info?.link||[]) const handleInput = (val,type)=>{ if(type==='label'){ setLabel(val) setVallue(val) }else{ setVallue(val) } } useEffect(()=>{ add({ label, value, link }) },[label,value]) return (
{info.label} setVisible(true)} className="rule_item_icon" type="edit" />
} visible={visible} align="l" triggerType="click" onClose={(_) => setVisible(false)} style={{ width: 300 }} >
显示值 handleInput(e,'label')} />
选项值 handleInput(e,'value')} />
); }; export default Item;