diff --git a/src/control/toolbar/toolbar.tsx b/src/control/toolbar/toolbar.tsx index 2524e536dc183b825f2191d720b22f614497245a..70dac78ad47cf632fa03299eb15efe061d34d1a7 100644 --- a/src/control/toolbar/toolbar.tsx +++ b/src/control/toolbar/toolbar.tsx @@ -108,6 +108,13 @@ export const ToolbarControl = defineComponent({ if (!pvisible) { return null; } + // 子项所有项都隐藏,父项也应该隐藏 + const pvisiblehiddenItem = detoolbarItems.every( + (item3: IData) => item3.hiddenItem === true, + ); + if (pvisiblehiddenItem) { + return null; + } // 当前项禁用或子项所有项都禁用,父项也应该禁用 const pdisabled = curDisabled || @@ -367,6 +374,9 @@ export const ToolbarControl = defineComponent({ state.extraButtons.before?.length > 0 && this.renderExtraButtons(state.extraButtons.before), this.modelData.detoolbarItems?.map((item, index) => { + if ((item as IData).hiddenItem) { + return null; + } const toolbarItemNode = this.renderToolbarItem(item); // 绘制指定位置后的额外按钮 if (state.extraButtons[index]?.length) { diff --git a/src/panel-component/nav-tabs/nav-tabs.tsx b/src/panel-component/nav-tabs/nav-tabs.tsx index 927d577ee5e72be54c55899e2820b3cef0003702..90f252a3454a2c62eb1ec24a9bddfd8556d92c0d 100644 --- a/src/panel-component/nav-tabs/nav-tabs.tsx +++ b/src/panel-component/nav-tabs/nav-tabs.tsx @@ -1,4 +1,4 @@ -import { defineComponent, PropType, VNode, watch } from 'vue'; +import { defineComponent, nextTick, PropType, ref, VNode, watch } from 'vue'; import { useNamespace } from '@ibiz-template/vue3-util'; import './nav-tabs.scss'; import { TabsPaneContext } from 'element-plus'; @@ -73,7 +73,31 @@ export const NavTabs = defineComponent({ }, ); - return { ns, actions, changePage, onTabRemove, handleCommand }; + const tabRef = ref(); + + watch( + () => c.state.tabItems, + (newVal, oldVal) => { + if (oldVal && newVal) { + nextTick(() => { + const dom = tabRef.value.$el.querySelector('.el-tabs__nav-next'); + if (dom) { + dom.click(); + } + }); + } + }, + { deep: true }, + ); + + return { + ns, + actions, + changePage, + onTabRemove, + handleCommand, + tabRef, + }; }, render() { const { state } = this.controller; @@ -86,6 +110,7 @@ export const NavTabs = defineComponent({ closable onTabClick={this.changePage} onTabRemove={this.onTabRemove} + ref='tabRef' > {state.tabItems.map(msg => { let label = msg.caption;