vue 本地模拟数据路径替换

proxyTable: {
            '/api': {
                target: 'http://localhost:8080',
                pathRewrite: {
                    '^/api': '/static/mock'
                }
            }
        },
  methods: {
    getHomeInfo() {
      axios.get("/api/index.json").then(this.getHomeInfoSucc); //
    },
    getHomeInfoSucc(res) {
      console.log(res);
    }
  },

猜你喜欢

转载自blog.csdn.net/weixin_42659625/article/details/82857075