公司项目需求,要把vue打包后的项目部署在网站二级域名下,类似于:www.xxx.com/home。
1.config/index.js 文件下
2.路由入口文件下src/router/index.js,
打包后,index.html文件中script标签引入文件地址如下:
最后:nginx部署的时候要用/home/ 反向代理,就可以了。
tips: 也有说在index.html入口文件也要加入
<meta base ="/home/">
build/webppack.base.conf.js文件下,也要注意下: