下拉选中问题

This commit is contained in:
caishi 2023-03-21 16:44:03 +08:00
parent 7d5f62c35d
commit 5c678c6bcf
4 changed files with 25 additions and 19 deletions

View File

@ -205,6 +205,7 @@ function AllMenus({owner,projectsId,chooseFunc,update,defaultNames,defaultIds,op
chooseFunc={(id,name)=>{let copy = {...ids,status_id:id && id.length>0 ? id.join(","):undefined};let copyname = { ...names,status_name:name};setNames(copyname);setIds(copy);chooseFunc(copy,copyname)}}
/>
{ !update && <Menus
className="minwidth"
ids={ids && ids.sort_by}
name={"排序"} size={"small"}
lists={open_blockchain ? array : array1}

View File

@ -31,19 +31,17 @@ function Drop({overlay , children , placement, overlayClassName},ref){
}
}
return(
<li>
<Dropdown
placement={placement}
visible={visible}
overlay={<div ref={refFa}>{overlay}</div>}
trigger={['click']}
overlayClassName={overlayClassName}
>
<span className="dropspan" ref={refBox} onClick={()=>setVisible(visible ? false : true)}>
{children}
</span>
</Dropdown>
</li>
<Dropdown
placement={placement}
visible={visible}
overlay={<div ref={refFa}>{overlay}</div>}
trigger={['click']}
overlayClassName={overlayClassName}
>
<span className="dropspan" ref={refBox} onClick={()=>setVisible(visible ? false : true)}>
{children}
</span>
</Dropdown>
)
}
export default forwardRef(Drop);

View File

@ -5,6 +5,7 @@ import Drop from './drop';
const { Search } = Input;
/**
* @param {className} <li>的样式名称
* @param {name} 未选择时显示的内容
* @param {lists} 下拉列表从接口获取需一一填充
* @param {imgControl} 控制是否显示头像
@ -15,7 +16,7 @@ const { Search } = Input;
* @param {update} 编辑状态
* @param {double} 是否可以多选
*/
function Menus({name, ids , lists , size , imgControl , searchFunc , chooseFunc , update , double ,names },ref){
function Menus({className,name, ids , lists , size , imgControl , searchFunc , chooseFunc , update , double ,names },ref){
const dropRef = useRef(null);
const [ chooseValue , setChooseValue ] = useState([]);
const [ showValue , setShowValue ] = useState(undefined);
@ -81,10 +82,12 @@ function Menus({name, ids , lists , size , imgControl , searchFunc , chooseFunc
</div>
}
return(
<Drop ref={dropRef} overlay={menu(lists)} placement={"bottomRight"} >
<span className="task-hide">{showValue || (update ? `更换${name}` : name) }</span>
<Icon type="caret-down" className="ml5 color-grey-6" />
</Drop>
<li className={className || ""}>
<Drop className={className} ref={dropRef} overlay={menu(lists)} placement={"bottomRight"} >
<span className="task-hide">{showValue || (update ? `更换${name}` : name) }</span>
<Icon type="caret-down" className="color-grey-6" />
</Drop>
</li>
)
}
export default Menus;

View File

@ -187,11 +187,15 @@
}
.dropboxul{
padding-right: 20px;
li.minwidth{
min-width: 70px;
}
li{
min-width: 106px;
min-width:88px;
display: flex;
justify-content: flex-end;
cursor: default;
margin-left: 12px;
.dropspan{
display: flex;
align-items: center;