使用了vue-cli的webpack模板搭建的环境,修改config目录下的index.js文件中的dev属性中的proxyTable按照如下说明进行配置

dev: {
    env: require('./dev.env'),
    port: 8080,
    autoOpenBrowser: true,
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    
    // *************************************
    proxyTable: { //代理路径表
        '/douban/api': { //要转发路径
        target: 'http://api.douban.com/v2', //目标服务器基路径
        changeOrigin: true, //是否替换Origin属性
        pathRewrite: { //配置重写路径
          '^/douban/api': ''
        }
      }
    },
    // *************************************
    
    // CSS Sourcemaps off by default because relative paths are "buggy"
    // with this option, according to the CSS-Loader README
    // (https://github.com/webpack/css-loader#sourcemaps)
    // In our experience, they generally work as expected,
    // just be aware of this issue when enabling this option.
    cssSourceMap: false,

  }