【发布时间】:2020-11-24 14:29:12
【问题描述】:
我尝试通过闪电在 visualforce 页面内创建一个 React 应用程序。当我在visualforce设置中点击预览时,一切都很好。
但是当我在 Lightning 应用程序生成器中使用它时,它不起作用。表明
错误:Refused to frame 'https://mirage-video-dev-ed--ltng.container.lightning.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors https://mirage-video-dev-ed--c.visualforce.com".
也很奇怪,如果我右键单击并选择“重新加载框架”,它会起作用。
Visualforce 代码
<apex:page >
<apex:includeLightning />
<div id="hello" />
<script>
$Lightning.use("c:myFirstApp", function() {
$Lightning.createComponent("lightning:container",
{ src: "{!$Resource.hello + '/index.html'}"},
"hello",
function(cmp) {
console.log("created");
// do some stuff
}
);
});
</script>
</apex:page>
我的第一个应用程序
<aura:application access="global" extends="ltng:outApp">
<aura:dependency resource="lightning:container"/>
</aura:application>
有办法解决吗?我找不到直接加载 aura:application 的方法,所以如果有方法请告诉我。
【问题讨论】:
-
仅供参考,以后请使用 salesforce.stackexchange 直接与 SF 相关的问题
标签: reactjs salesforce visualforce salesforce-lightning