如何解决Salesforce Aura UtilityBar获取主屏幕URL
我正在根据用户当前的URL开发一些逻辑。当我弹出实用工具栏时,是否可以获取其他Chrome主窗口的URL?这是我的示例代码。
组件:
<aura:component implements="flexipage:availableForAllPageTypeslightning:utilityItem" access="global">
<lightning:utilityBaraPI aura:id="MyUtilityBar" />
<!-- Base init -->
<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:method name="checkUrl" action="{!c.urlChanged}" />
<aura:handler event="aura:locationChange" action="{!c.urlChanged}"/>
</aura:component>
控制器:
({
doInit : function(component,event,helper)
{
// Check for any changes in record values every 20 seconds since we can't listen for
// record edits
component.checkUrl();
window.setInterval(
$A.getCallback(function() {
component.checkUrl()
}),20 * 1000
);
},urlChanged : function (component,helper)
{
// This always show the popout url like below when popped out
// https://blah.lightning.force.com/lightning/popout/utility?0.windowed=true
console.log(window.location.pathname);
}
})
如何获取其他窗口或弹出的主窗口的URL?代替
“ https://blah.lightning.force.com/lightning/popout/utility?0.windowed=true”(显示的网址),
我想看类似的东西
“ https://blah.lightning.force.com/lightning/page/home”(主页)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。