vue项目打包
vue项目build之后,dist文件下index.html打开为空白页
build: {
dev: {
assetsPublicPath:"./",
}
}
scripts: {
"dev":" --host 192.168.3.45" ,
}
mode:'history',
打包之后请求不成功
1. 在config下的index.js中,把跨域请求拦截代码注释掉。
proxyTable: {
'/api': {
target: "http://47.92.153.134:/",
pathRewrite: {
'^/api': ''
}
}
},
axios.defaults.baseURL = 'http://47.92.153.134:/'
此时点击index.html,通过浏览器运行便,若会发现动态绑定的static的图片找不到,故static必须使用绝对路径。将图片路径修改为绝对路径,至此,打包完成。