vue-cli3 手机局域网访问设置

 

cli3 不会自动生成vue.config.js文件,需要自己创建

src同级创建

 

 

module.exports = {
  lintOnSave: false, //如果为false,就是取消eslint规则的检查
  outputDir:'dist',
 assetsDir:'static',
  publicPath: './',
  devServer: {
    host:'172.16.8.86',//本地ip
    port:'8081',
    https:false,
    proxy: {//代理解决跨域
      '/api': {
        target: 'http://172.16.8.47:8096',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/api', // rewrite path
        },
      }
    }
  }
}

手机连接同一个局域网 访问

http://172.16.8.86:8081/

成功查看效果。

posted @ 2021-05-15 16:05  明媚下雨天  阅读(456)  评论(0编辑  收藏  举报