首页 > Web开发 > 详细

Vue技术点整理-vue.config.js

时间:2020-04-17 18:36:37      阅读:81      评论:0      收藏:0      [点我收藏+]

1,proxy代理解决本地开发环境跨域问题

配置proxy代理后,proxy会将任何未知请求 (没有匹配到静态文件的请求) 代理到 https://192.168.3.49:8080

vue.config.js配置

devServer: {
    proxy: {
      /edu-api: {
        target: `https://192.168.3.49:8080`,
        changeOrigin: true,
      }
    }
  }

业务请求代码

axios.get("/edu-api/userList")
.then(response => {
    console.info(response)
})

 2,vue-cli打包后,增加时间戳后缀名,避免缓存问题

const Timestamp = new Date().getTime();
module.exports = {
    configureWebpack: {
    output: {
      filename: `[name].${Timestamp}.js`,
      chunkFilename: `[name].${Timestamp}.js`
    }
   }
}

  

Vue技术点整理-vue.config.js

原文:https://www.cnblogs.com/front-web/p/12721649.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!