1. 找到vue项目/config/index.js文件,在proxyTable里面添加代理,示例如下:
proxyTable: {
'/api':{
target: 'http://web.juhe.cn:8080',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/api':'/'
}
}
}
// 注意:以后用api替换‘http://web.juhe.cn:8080’这个长的地址
2. 在main.js 设置 axios.defaults.baseURL=”/api”
或是
axios.create({
baseURL: '/api', // api 的 base_url
timeout: 5000 // request timeout
})
3. 接口请求处,直接更改就行了,示例如下:
比如:之前的url为'http://web.juhe.cn:8080/constellation/getAll'直接改成url为'/constellation/getAll'
1. 将icon放在与index.html同级的目录下
2. 在webpack.dev.conf.js中,新增代码
const path = require('path')
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true,
favicon: path.resolve('favicon.ico') // 新增
})
3. 同样的在webpack.prod.conf.js中添加代码
favicon: path.resolve('favicon.ico'), //新增