cordova android vue avd 资源 public 图片

cordova android vue avd resource public image

我按照本教程编写了自己的 android cordova 应用程序:

https://www.npmjs.com/package/vue-cli-plugin-cordova

我将应用程序的图像添加到 public 文件夹中。我的整个文件夹 看起来像这样:

my-app2:
|-.git
|-node_modules
|-public --> there are my images in the img folder, the index.css in the css folder and the index.html as main entry point
|-src --> there is my Sourcecode folder which works fine
|-src-cordova --> In this folder are the settings for my app (config.xml)
|-tests
|-.gitignore
|-babel.config
|-cypress
|-my-release-key.keystore
|-package
|-package-lock
|-README.md
|-vue.config
|-yarn.lock

public 文件夹包含所有图像和主要入口点 我的应用程序:index.html-文件

我用这个相对路径引用了这些图像文件:

img/weiss.png

现在我 运行 以下命令,一切正常。

npm run cordova-serve-browser

然后我用 cordova 为 android:

构建了它
npm run cordova-build-android

然后我将它安装在我的 avd 上,但没有得到这些图像 显示。 (您必须安装 jdk 1.8、gradle、android studio、android sdk ...)

我现在的问题是,如何引用这些图像 我必须在我的 cordova 配置中设置什么?

我解决了问题。

是关于路由器配置的。您不必使用模式历史记录。始终使用模式

hash

这是我的路由器:

'use strict'
import Vue from 'vue'
import VueRouter from 'vue-router'