electron-vue webview 白屏

发布于 2022-09-11 23:02:39 字数 1928 浏览 21 评论 0

<div id="app">
    <webview src="https://github.com/electron/electron-quick-start" style="width:200px;height:200px"></webview>
</div>

很简单的代码,不用electron-vue webview是可以显示出来的。把代码放在electron-vue里面运行,webview显示不出来,而且html渲染结果也很奇怪。如图:

image.png

{
  "dependencies": {
    "vue": "^2.5.16",
    "axios": "^0.18.0",
    "vue-electron": "^1.0.6",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1",
    "vuex-electron": "^1.0.0"
  },
  "devDependencies": {
    "ajv": "^6.5.0",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.26.0",
    "babili-webpack-plugin": "^0.1.2",
    "cfonts": "^2.1.2",
    "chalk": "^2.4.1",
    "copy-webpack-plugin": "^4.5.1",
    "cross-env": "^5.1.6",
    "css-loader": "^0.28.11",
    "del": "^3.0.0",
    "devtron": "^1.4.0",
    "electron": "^6.0.12",
    "electron-debug": "^1.5.0",
    "electron-devtools-installer": "^2.2.4",
    "electron-packager": "^12.1.0",
    "electron-rebuild": "^1.8.1",
    "mini-css-extract-plugin": "0.4.0",
    "file-loader": "^1.1.11",
    "html-webpack-plugin": "^3.2.0",
    "multispinner": "^0.2.1",
    "node-loader": "^0.6.0",
    "node-sass": "^4.9.2",
    "sass-loader": "^7.0.3",
    "style-loader": "^0.21.0",
    "url-loader": "^1.0.1",
    "vue-html-loader": "^1.2.4",
    "vue-loader": "^15.2.4",
    "vue-style-loader": "^4.1.0",
    "vue-template-compiler": "^2.5.16",
    "webpack-cli": "^3.0.8",
    "webpack": "^4.15.1",
    "webpack-dev-server": "^3.1.4",
    "webpack-hot-middleware": "^2.22.2",
    "webpack-merge": "^4.1.3"
  }
}

image.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

踏月而来 2022-09-18 23:02:39

我在github上找到了解决方法,亲测可用。
禁用Cross-Origin-Opener-Policy功能,就可以显示

app.commandLine.appendSwitch('disable-features', 'CrossOriginOpenerPolicy')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文