🐛 修复 ProList Each child in a list should have a unique "key" prop.

pull/31/head
smallbun 1 year ago
parent d354cfe94a
commit 95dda06451

@ -27,7 +27,7 @@ import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import type { ActionType } from '@ant-design/pro-components'; import type { ActionType } from '@ant-design/pro-components';
import { PageContainer, ProList } from '@ant-design/pro-components'; import { PageContainer, ProList } from '@ant-design/pro-components';
import { App, Avatar, Button, Popconfirm, Tag } from 'antd'; import { App, Avatar, Button, Popconfirm, Tag } from 'antd';
import { useRef, useState } from 'react'; import { Fragment, useRef, useState } from 'react';
import CreateModal from './components/CreateModal'; import CreateModal from './components/CreateModal';
import useStyle from './style'; import useStyle from './style';
import classnames from 'classnames'; import classnames from 'classnames';
@ -140,7 +140,7 @@ export default () => {
}, },
actions: { actions: {
render: (text, row) => [ render: (text, row) => [
<> <Fragment key={'status'}>
{row.enabled ? ( {row.enabled ? (
<Popconfirm <Popconfirm
title={intl.formatMessage({ title={intl.formatMessage({
@ -192,7 +192,7 @@ export default () => {
<a key="enabled">{intl.formatMessage({ id: 'app.enable' })}</a> <a key="enabled">{intl.formatMessage({ id: 'app.enable' })}</a>
</Popconfirm> </Popconfirm>
)} )}
</>, </Fragment>,
<a <a
key={'detail'} key={'detail'}
onClick={() => { onClick={() => {

@ -31,7 +31,7 @@ import type { ActionType } from '@ant-design/pro-components';
import { PageContainer, ProList } from '@ant-design/pro-components'; import { PageContainer, ProList } from '@ant-design/pro-components';
import { useMount } from 'ahooks'; import { useMount } from 'ahooks';
import { App, Avatar, Button, Popconfirm, Tag, Typography } from 'antd'; import { App, Avatar, Button, Popconfirm, Tag, Typography } from 'antd';
import { useRef, useState } from 'react'; import { Fragment, useRef, useState } from 'react';
import CreateDrawer from './components/CreateModal'; import CreateDrawer from './components/CreateModal';
import UpdateDrawer from './components/UpdateModal'; import UpdateDrawer from './components/UpdateModal';
import { EXIST_CALLBACK, IdentityProviderCategory } from './constant'; import { EXIST_CALLBACK, IdentityProviderCategory } from './constant';
@ -216,11 +216,11 @@ const List = (props: { category: IdentityProviderCategory }) => {
}, },
content: { content: {
search: false, search: false,
render: (text, row) => [<ListContent key="context" {...row} />], render: (text, row) => <ListContent key="context" {...row} />,
}, },
actions: { actions: {
render: (text, row) => [ render: (text, row) => [
<> <Fragment key={'status'}>
{row.enabled ? ( {row.enabled ? (
<Popconfirm <Popconfirm
title={intl.formatMessage({ title={intl.formatMessage({
@ -246,7 +246,7 @@ const List = (props: { category: IdentityProviderCategory }) => {
cancelText={intl.formatMessage({ id: 'app.no' })} cancelText={intl.formatMessage({ id: 'app.no' })}
key="disabled" key="disabled"
> >
<a key="disabled"> <a>
{intl.formatMessage({ {intl.formatMessage({
id: 'app.disable', id: 'app.disable',
})} })}
@ -269,16 +269,16 @@ const List = (props: { category: IdentityProviderCategory }) => {
}} }}
okText={intl.formatMessage({ id: 'app.yes' })} okText={intl.formatMessage({ id: 'app.yes' })}
cancelText={intl.formatMessage({ id: 'app.no' })} cancelText={intl.formatMessage({ id: 'app.no' })}
key="disabled" key="enabled"
> >
<a key="enabled"> <a>
{intl.formatMessage({ {intl.formatMessage({
id: 'app.enable', id: 'app.enable',
})} })}
</a> </a>
</Popconfirm> </Popconfirm>
)} )}
</>, </Fragment>,
<a <a
key="update" key="update"
onClick={() => { onClick={() => {

Loading…
Cancel
Save