Electron-vue-Electron Security Warning (Insecure Content-Security-Policy) 告警解决
方式一:index.html文件里设置安全策略
在HTML主文件的头部引入安全策略的设置,采用如下设置,Electron的控制台就不会显示告警了:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline';">
我尝试过在/src/index.ejs中使用如上方法,发现不行还是报错;估计是我找到这个不是这个文件,但是实在是找不到index.html文件了.
方式二:main.js文件里屏蔽安全告警
在Electron工程启动文件main.js的头部设置以下内容,也可以屏蔽安全告警在console控制台的显示:
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
在/src/main/index.js中第四行添加,该方法成功,让我的项目不再报错;
方法参考自Electron Security Warning (Insecure Content-Security-Policy) 告警解决
[dangerbox title=”标题内容”]祝大家新年快乐[/dangerbox]
如何为你的网站植入广告,赚取收益呢!GoogleAdsense首选!!vue报错Failed to mount component: template or render function not defined. found in
快捷登陆