【发布时间】:2020-09-15 10:04:04
【问题描述】:
如果我想在 Webview 中显示本地 html 文件,我该怎么做?
尝试过的解决方案:
- 我想在 web 视图中显示的相应 html 的绝对路径,如下所示:
Absolute path/ encodeURI
this.htmlPath = encodeURI(`${fs.knownFolders.currentApp().path}/monitordaten/webview/assets/graph.html`);
<Webview #myWebView [src]="htmlPath" ></Webview>
- 像这样编辑 webpack.config.js:
这里提到了这个解决方案:edit webpack.config.js
new CopyWebpackPlugin([
{ from: { glob: "monitrodaten/webview/assets/**"} }, <= Added this row
{ from: { glob: "fonts/**" } },
{ from: { glob: "**/*.jpg" } },
...
【问题讨论】:
标签: android webview nativescript