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