vue.config.js 基础配置

1.如何关闭eslint对代码的判断

// vue.config.js
module.exports = {
    lintOnSave: false
}

2.如何在vue.config.js中进行前端跨域

// vue.config.js
module.exports = {
  devServer: {
    proxy: {
      '/api': { // 存在什么的时候进行跨域 
        target: 'http://xxx:8086', // 目标服务器地址
        changeOrigin: true, // 允许改变请求头中的源
        pathRewrite: {'^/api': ''} // 重写路径
      }
    }
  }
}

おすすめ

転載: blog.csdn.net/m0_66675766/article/details/131087663