我正在尝试将使用 VueJS 开发的小型混合 C#/单页应用程序 bundle 为 Android 应用程序。我们有一些类,它们创建和成像并将其发送到 ESC 打印机。如果我们从服务器加载应用程序,一切正常:
theView.LoadUrl( "https://our-app.our-server.com" );
然而,当我们从 file:///android_asset/index.html 加载它时,它开始了,但页面是空的。
我在 chrome 调试器中看到,VueJS 成功创建了一些元素:
<div data-app="true" class="application app theme--light">
<div class="application--wrap">
<main class="v-content" data-booted="true" style="padding: 0px;">
<div class="v-content__wrap"></div>
</main>
</div>
</div>
控制台中没有错误,只是一个空屏幕。
我错过了什么?
最佳答案
这里发生了几件事。如果您打算在本地主机上提供 webview,我想您的“我想通了”是正确的解决方案。
我正在尝试使用 Vue 实例在 webview 中离线运行。这就是 JustinHui 的回应对我有用的地方。我没有从 vue cli 生成的 index.html 中手动删除斜杠,而是转到 vue.config.js 并将 publicPath 设置为空字符串。这就解决了。
关于android - Android WebView 中的 VueJS (Xamarin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58567540/