运行文件时出现GET http://localhost:8080/api 404 (Not Found)。

用VUE仿链家网的时候,运行文件时出现GET http://localhost:8080/api 404 (Not Found)。

dev: {
  // Paths
  assetsSubDirectory: 'static',
  assetsPublicPath: '/',
  proxyTable: {
    '/api': {
      target: 'http://47.110.132.127:6789/city/get/data',
      changeOrigin: true,
      pathRewrite: {
        '^/api': '/data'
      }
    }
  },
  
  getPageInfo () {
  /// 地址为后台数据地址为后台数据地址为后台数据地址为后台数据地址为后台数据
  axios.get('/api', {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
    .then(function (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.total = data.total
        this.pagingVolume = data.pagingVolume
        this.current = data.current
        this.contentList = data.contentList /// 前后名字一样
      }
    }) /// 先接受json文件,然后返回函数
    .catch(function (error) {
      console.log(error)
    })
}


慕田峪2258837
浏览 17458回答 1
1回答

pardon110

访问本地接口看看不就知道了
打开App,查看更多内容
随时随地看视频慕课网APP