在vue项目目录下执行
cordova create hello
cd hello
cordova platform add android
vue.config.js中:
outputDir:'hello/www', publicPath:''
Axios文件中:
Axios.defaults.baseURL = '需要请求的完整url/api'
hello\platforms\android\app\src\main\AndroidManifest.xml中:
<application android:usesCleartextTraffic="true"
路由文件
new VueRouter({ mode: 'hash',
...
})
mode改为'hash',使用history会导致调整其他页面js,css异常
真机调试
cordova run android
谷歌浏览器输入
chrome://inspect/#devices
可直接打开控制台看到报错信息