https://developer.salesforce.com/docs/component-library/bundle/lightning:workspaceAPI/documentation
背景: 针对Console App,我们可以看到官方提供的功能可以修改Tab名称,刷新Tab等功能。我们在针对实际开发时,偶尔也需要有需求操作Tab相关信息,比如修改Tab的名称。以前只能通过Aura Component进行修改,lwc并不支持。
CustomizeTabAura.cmp
<aura:component implements="lightning:isUrlAddressable,flexipage:availableForAllPageTypes" access="GLOBAL"> <lightning:workspaceAPI aura:id="workspace" /> <aura:attribute name="result" type="String"></aura:attribute> <lightning:card> <lightning:buttonGroup> <lightning:button onclick="{!c.showTabInfo}" label="显示Tab信息"></lightning:button> <lightning:button onclick="{!c.changeTabInfo}" label="更改Tab信息"></lightning:button> <lightning:button onclick="{!c.addSubTabInfo}" label="打开Sub Tab"></lightning:button> </lightning:buttonGroup> <div> {!v.result} </div> </lightning:card> </aura:component>
09-11 13:47