hide the add new tab button when not designable

This commit is contained in:
chenos 2021-08-05 18:53:44 +08:00
parent 8f746ae319
commit 6da37c6509

View File

@ -45,8 +45,15 @@ const useTabs = ({ singleton }) => {
export const Tabs: any = observer((props: any) => { export const Tabs: any = observer((props: any) => {
const { singleton, ...others } = props; const { singleton, ...others } = props;
const { schema, DesignableBar, appendChild, root, remove, insertAfter } = const {
useDesignable(); designable,
schema,
DesignableBar,
appendChild,
root,
remove,
insertAfter,
} = useDesignable();
const tabs = useTabs({ singleton }); const tabs = useTabs({ singleton });
const [dragOverlayContent, setDragOverlayContent] = useState(''); const [dragOverlayContent, setDragOverlayContent] = useState('');
@ -97,6 +104,7 @@ export const Tabs: any = observer((props: any) => {
{...others} {...others}
className={cls({ singleton })} className={cls({ singleton })}
tabBarExtraContent={ tabBarExtraContent={
designable && (
<Button <Button
type={'dashed'} type={'dashed'}
icon={<PlusOutlined />} icon={<PlusOutlined />}
@ -156,6 +164,7 @@ export const Tabs: any = observer((props: any) => {
> >
</Button> </Button>
)
} }
> >
{tabs.map(({ props, schema, name }, key) => ( {tabs.map(({ props, schema, name }, key) => (