Add search to select

This commit is contained in:
2023-11-15 18:20:11 +08:00
parent 326c808622
commit 4a16367f45
2 changed files with 5 additions and 0 deletions

View File

@@ -257,6 +257,9 @@ const Group: React.FC = () => {
setIsDrawerOpen(false)
}
const filterOption = (input: string, option?: { label: string; value: string }) =>
(option?.label ?? '').toLowerCase().includes(input.toLowerCase())
const handleOnSubmit = () => {
if (isSubmitting) {
return
@@ -586,6 +589,7 @@ const Group: React.FC = () => {
mode={'multiple'}
allowClear
showSearch
filterOption={filterOption}
options={roleData.map((value) => ({
value: value.id,
label: `${value.name}${!value.enable ? '(已禁用)' : ''}`

View File

@@ -599,6 +599,7 @@ const Role: React.FC = () => {
treeCheckable
treeNodeLabelProp={'fullTitle'}
allowClear
treeNodeFilterProp={'fullTitle'}
loading={isLoadingPower}
/>
</AntdForm.Item>