//第一种配置文件方式
1.本地使用测试环境的域名,在c盘的hosts文件添加一行:127.0.0.1 www.test.com(你要使用的域名)
2. const service = axios.create({
baseURL: 'http://www.test.com:端口号/my-bill',
timeout: 5000 //请求超时时间
});
3. dev-sever.js文件中监听var uri='http://www.test.com:' + port
//第二种配置文件方式
或者在config文件下的index.js中host:'www.test.com',
在build/webpack.dev.conf.js中的devServer对象属性中添加属性disableHostCheck: true
网友评论