From 8bb082187b007475e3a1f9c6ed12bf1854ba5309 Mon Sep 17 00:00:00 2001 From: tikkhun Date: Thu, 18 Dec 2025 15:34:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(Shop/Customers):=20=E5=BD=93siteId=E5=8F=98?= =?UTF-8?q?=E5=8C=96=E6=97=B6=E9=87=8D=E6=96=B0=E5=8A=A0=E8=BD=BD=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加useEffect监听siteId变化,确保表格数据及时更新 --- src/pages/Site/Shop/Customers/index.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/Site/Shop/Customers/index.tsx b/src/pages/Site/Shop/Customers/index.tsx index e95618a..ebdac52 100644 --- a/src/pages/Site/Shop/Customers/index.tsx +++ b/src/pages/Site/Shop/Customers/index.tsx @@ -1,7 +1,7 @@ import { ActionType, DrawerForm, ModalForm, PageContainer, ProColumns, ProFormText, ProFormTextArea, ProTable } from '@ant-design/pro-components'; import { request, useParams } from '@umijs/max'; import { App, Avatar, Button, Modal, Popconfirm, Space, Tag } from 'antd'; -import React, { useRef, useState } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { DeleteFilled, EditOutlined, PlusOutlined, UserOutlined } from '@ant-design/icons'; const BatchEditCustomers: React.FC<{ @@ -65,6 +65,13 @@ const CustomerPage: React.FC = () => { const [ordersVisible, setOrdersVisible] = useState(false); const [ordersCustomer, setOrdersCustomer] = useState(null); + useEffect(() => { + // 当siteId变化时, 重新加载表格数据 + if (siteId) { + actionRef.current?.reload(); + } + }, [siteId]); + const handleDelete = async (id: number) => { if (!siteId) return; try {