fix: edit modal form not update

This commit is contained in:
jialin
2024-07-18 19:30:42 +08:00
parent 714e2d927a
commit 34b5c2b034
+5 -5
View File
@@ -2,7 +2,7 @@ import { MoreOutlined } from '@ant-design/icons';
import { useIntl } from '@umijs/max'; import { useIntl } from '@umijs/max';
import { Button, Dropdown, Tooltip, type MenuProps } from 'antd'; import { Button, Dropdown, Tooltip, type MenuProps } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import { memo, useCallback } from 'react'; import { memo } from 'react';
interface DropdownButtonsProps { interface DropdownButtonsProps {
items: MenuProps['items']; items: MenuProps['items'];
@@ -16,16 +16,16 @@ const DropdownButtons: React.FC<DropdownButtonsProps> = ({
onSelect onSelect
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
const handleMenuClick = useCallback((item: any) => { const handleMenuClick = (item: any) => {
console.log('menu click', item.key); console.log('menu click', item.key);
const selectItem = _.find(items, { key: item.key }); const selectItem = _.find(items, { key: item.key });
onSelect(item.key, selectItem); onSelect(item.key, selectItem);
}, []); };
const handleButtonClick = useCallback((e: any) => { const handleButtonClick = (e: any) => {
const headItem = _.head(items); const headItem = _.head(items);
onSelect(headItem.key, headItem); onSelect(headItem.key, headItem);
}, []); };
if (!items?.length) { if (!items?.length) {
return <span></span>; return <span></span>;