modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios'
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    proxy: true,
    prefix: '/api/',
    credentials: true
    // See https://github.com/nuxt-community/axios-module#options
  },

  proxy: {
    '/api/': { 
      target: 'https://h5api.zhefengle.cn',//这个网站是开源的可以请求到数据的
      pathRewrite: {
         '^/api/': '/',
         changeOrigin: true
      }    
    }
  },

然后在你的页面可以直接请求数据了

mounted() {
        this.$axios.get("/index.html").then(res=>{
            console.log(res)
        })
    },

https://www.jianshu.com/p/7d105f3e28f1

相关文章:

  • 2021-09-23
  • 2021-12-07
  • 2021-06-20
  • 2021-05-08
  • 2021-05-28
  • 2021-10-31
  • 2022-12-23
猜你喜欢
  • 2021-06-30
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-08-18
  • 2021-08-04
  • 2021-09-19
相关资源
相似解决方案