vue2.x打包项目到某个目录的操作
如果要把项目打包到http://xxx/lottery_tools,需要修改两个地方。1、config/index.js 打包路径配置:
......
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'lottery_tools_static',
assetsPublicPath: '/lottery_tools/', //关键位置
......
2、修改路由表src/rounter/index.js
routes: [
{
path: '/lottery_tools/',
component: Index,
meta: {
title: '实用工具',
showBac: false
}
},
{
path: '/lottery_tools/kl8/shrink',
component: kl8Shrink,
meta: {
title: '矩阵缩水',
showBac: false
},
},
]
})
已验证,没问题。