修复遍历key值

This commit is contained in:
whyour 2022-09-20 01:23:33 +08:00
parent 931638b687
commit 5168b044a3
4 changed files with 22 additions and 18 deletions

View File

@ -50,6 +50,7 @@ const EditableTagGroup = ({
{tag} {tag}
</Tag> </Tag>
); );
return ( return (
<span key={tag} style={{ display: 'inline-block', marginBottom: 8 }}> <span key={tag} style={{ display: 'inline-block', marginBottom: 8 }}>
{tagElem} {tagElem}

View File

@ -382,7 +382,7 @@ const CronDetailModal = ({
{currentCron.labels?.length > 0 && {currentCron.labels?.length > 0 &&
currentCron.labels[0] !== '' && currentCron.labels[0] !== '' &&
currentCron.labels?.map((label: string, i: number) => ( currentCron.labels?.map((label: string, i: number) => (
<Tag color="blue" style={{ marginRight: 5 }}> <Tag key={label} color="blue" style={{ marginRight: 5 }}>
{label} {label}
</Tag> </Tag>
))} ))}

View File

@ -108,6 +108,7 @@ const Crontab = () => {
{record.labels?.map((label: string) => ( {record.labels?.map((label: string) => (
<Tag <Tag
color="blue" color="blue"
key={label}
style={{ cursor: 'point' }} style={{ cursor: 'point' }}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -413,7 +414,8 @@ const Crontab = () => {
const getCrons = () => { const getCrons = () => {
setLoading(true); setLoading(true);
const { page, size, sorter, filters } = pageConf; const { page, size, sorter, filters } = pageConf;
let url = `${config.apiPrefix let url = `${
config.apiPrefix
}crons?searchValue=${searchText}&page=${page}&size=${size}&filters=${JSON.stringify( }crons?searchValue=${searchText}&page=${page}&size=${size}&filters=${JSON.stringify(
filters, filters,
)}`; )}`;
@ -585,7 +587,8 @@ const Crontab = () => {
onOk() { onOk() {
request request
.put( .put(
`${config.apiPrefix}crons/${record.isDisabled === 1 ? 'enable' : 'disable' `${config.apiPrefix}crons/${
record.isDisabled === 1 ? 'enable' : 'disable'
}`, }`,
{ {
data: [record.id], data: [record.id],
@ -630,7 +633,8 @@ const Crontab = () => {
onOk() { onOk() {
request request
.put( .put(
`${config.apiPrefix}crons/${record.isPinned === 1 ? 'unpin' : 'pin' `${config.apiPrefix}crons/${
record.isPinned === 1 ? 'unpin' : 'pin'
}`, }`,
{ {
data: [record.id], data: [record.id],
@ -1090,13 +1094,11 @@ const Crontab = () => {
label: '全部任务', label: '全部任务',
children: panelContent, children: panelContent,
}, },
...[...enabledCronViews].slice(0, 2).map((x) => ( ...[...enabledCronViews].slice(0, 2).map((x) => ({
{
key: x.id, key: x.id,
label: x.name, label: x.name,
children: panelContent children: panelContent,
} })),
)),
]} ]}
> >
<Tabs.TabPane tab="全部任务" key="all"> <Tabs.TabPane tab="全部任务" key="all">

View File

@ -124,6 +124,7 @@ const Initialization = () => {
</Form.Item> </Form.Item>
{fields.map((x) => ( {fields.map((x) => (
<Form.Item <Form.Item
key={x.label}
label={x.label} label={x.label}
name={x.label} name={x.label}
extra={x.tip} extra={x.tip}