pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🧐[问题]使用ProTable控制台的警告怎么去掉啊!!!!看着膈应人😔

Open freesaber opened this issue 6 months ago • 15 comments

开发环境:

  • node v20.16.0
  • vite v5.20.0
  • ant v5.4.0

页面代码:

import { EllipsisOutlined, PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable, TableDropdown } from '@ant-design/pro-components';
import { Button, Dropdown, Space, Tag } from 'antd';
import { useRef } from 'react';
import { Auth } from '@/types'
import { getRolePage } from '@/api/authApi';

const columns: ProColumns<Auth.Role>[] = [
  {
    dataIndex: 'index',
    valueType: 'indexBorder',
    width: 48,
  },
  {
    title: '角色编码',
    key: 'code',
    dataIndex: 'code'
  },
  {
    title: '角色名称',
    key: 'name',
    dataIndex: 'name'
  },
  {
    title: '角色描述',
    key: 'description',
    dataIndex: 'description'
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    valueType: 'dateRange',
    hideInTable: true,
    search: {
      transform: (value) => {
        return {
          startTime: value[0],
          endTime: value[1],
        };
      },
    },
  },
  {
    title: '操作',
    valueType: 'option',
    key: 'option',
    render: (text, record, _, action) => [
      <a>
        编辑
      </a>,
      <a >
        查看
      </a>
    ],
  },
];

export default () => {
  const actionRef = useRef<ActionType>();
  return (
    <ProTable<Auth.Role>
      columns={columns}
      actionRef={actionRef}
      cardBordered
      request={async (params, sort, filter) =>  {
        const result = await getRolePage({
          'qp-orgCode-eq': 'ORG1437957814041632769',
          currentPage: params.current || 1,
          pageSize: params.pageSize,
        });
        return {
          data: result.list,
          success: true,
          total: Number(result.totalCount),
        };
      }}

      rowKey="id"
      search={{
        labelWidth: 'auto',
      }}
      pagination={{
        pageSize: 5,
        onChange: (page) => console.log(page),
      }}
      dateFormatter="string"

    />
  );
};

控制台警告内容:

Warning: findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node
    at SingleObserver (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:2390:24)
    at ResizeObserver3 (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:2467:24)
    at http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:22667:34
    at Tooltip2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:27959:32)
    at http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:28611:16
    at span
    at div
    at div
    at div
    at div
    at div
    at DomWrapper4 (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:2376:5)
    at SingleObserver (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:2390:24)
    at ResizeObserver3 (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:2467:24)
    at ListToolBar2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:45294:34)
    at ToolBar (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:45600:27)
    at ToolbarRender2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:45680:5)
    at div
    at div
    at http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:23008:25
    at div
    at TableRender (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:46679:22)
    at ProTable2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:46875:28)
    at ErrorBoundary2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:10980:5)
    at ProConfigProvider2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:10861:24)
    at Container2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:44206:34)
    at ProviderTableContainer2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:47240:52)
    at http://127.0.0.1:8480/business/src/pages/AuthManagement/RoleManagement/index.tsx?t=1723192815125:76:21
    at RenderedRoute (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:4007:5)
    at Outlet (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:4377:26)
    at div
    at div
    at Watermark (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:105957:5)
    at div
    at div
    at div
    at GridContent2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:36876:46)
    at div
    at PageContainerBase2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:37519:24)
    at MotionWrapper (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7318:5)
    at ProviderChildren (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7423:5)
    at ConfigProvider (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7701:27)
    at ConfigProviderContainer2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:10768:24)
    at LocaleProvider (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:4822:13)
    at MotionWrapper (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7318:5)
    at ProviderChildren (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7423:5)
    at ConfigProvider (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7701:27)
    at ProConfigProvider2 (http://127.0.0.1:8480/business/node_modules/.vite/deps/@ant-design_pro-components.js?v=a53a8d84:10861:24)
    at PageContainer2
    at div
    at http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:68581:16
    at Layout
    at div
    at http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:68581:16
    at Layout
    at window.$RefreshReg$ (http://127.0.0.1:8480/business/src/layout/ManageLayout.tsx?t=1723190756113:29:27)
    at RenderedRoute (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:4007:5)
    at RenderErrorBoundary (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:3967:5)
    at DataRoutes (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:5119:5)
    at Router (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:4384:15)
    at RouterProvider (http://127.0.0.1:8480/business/node_modules/.vite/deps/react-router-dom.js?v=a53a8d84:4936:5)
    at div
    at App (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:20532:16)
    at MotionWrapper (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7318:5)
    at ProviderChildren (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7423:5)
    at ConfigProvider (http://127.0.0.1:8480/business/node_modules/.vite/deps/chunk-J7ADA5S5.js?v=a53a8d84:7701:27)
    at window.$RefreshReg$ (http://127.0.0.1:8480/business/src/App.tsx?t=1723192815125:25:18)

截图: image

freesaber avatar Aug 09 '24 08:08 freesaber