gpt4 book ai didi

admin-on-rest - TabbedForm - 在 FormTab 上有条件地显示工具栏(提交按钮)

转载 作者:行者123 更新时间:2023-12-03 23:54:54 25 4
gpt4 key购买 nike

有没有办法在使用 TabbedForm 时有条件地删除特定选项卡中的提交按钮(工具栏)? ( react 管理员)

TabbedForm

最佳答案

这是我使用自定义工具栏的方法:

<TabbedForm toolbar={<PostEditToolbar {...props} />}>...

工具栏看起来像这样:

const PostEditToolbar = props => {
const { hasList, hasEdit, hasShow, hasCreate, redirect, ...rest } = props
return (
<Toolbar {...props}>
<Route exact path={'/Posts/:id/:tab_index'} render={props => ''} />
<Route
exact
path={'/Posts/:id'}
render={props => (
<SaveButton redirect={`/Posts/${rest.id}`} {...rest} />
)}
/>
</Toolbar>
)
}

您将需要 import { Route } from 'react-router-dom'为此,还可以根据需要调整路线路径。

关于admin-on-rest - TabbedForm - 在 FormTab 上有条件地显示工具栏(提交按钮),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50085587/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com