vue2.0配置代理需要在config==》index.js中这样的好处在于配置axios'时候不需要特意去配置请求地址,需要重启服务等一会。
vue配置出现ip地址访问
1.config==》index.js中将host配置为‘0.0.0.0’
2在build==〉webpack.dev.conf.js中compilationSuccessInfo配置为
messages: [
`App runing at: `,
`Local: http://localhost:${port}`,
`Network: http://${require('ip').address()}:${port}`,
],
3.需要在package.json中配置
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 0.0.0.0",
"start": "npm run dev",
"build": "node build/build.js"
},
重启服务
网友评论