找到package.json
在对应的vue的项目目录下面新建vue.config.js
写入下面的配置
module.exports = {
publicPath: '/h5/dist/', //代表部署的域名访问的目录
outputDir: 'dist',//打包后在当前目录下生成打包后的dist文件,把dist文件放置到对应的域名/h5/下面即可
assetsDir: 'static',
lintOnSave: false,
productionSourceMap: false //去除打包后js的map文件
}
cd mytest
执行:npm run build 进行打包
然后把dist文件放到对应的项目服务器的对应目录下面,下面以 域名+/h5/dist/为例
https://test.okall.com.cn/h5/dist/#/ 既可以运行
如何解决刷新页面404的问题,在路由下面配置路由的模式为hash
const router &#