フロントエンドのVueプロジェクトは、クロスドメインの問題を解決します

1. config / index.jsで:

proxyTable: {
      '/api': {
        target: 'http://192.168.10.000:8066',//api地址
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    },

2.ページの使用:

this.$axios.post("/api/signin",loginParams).then(data=>{
    
}).catch(err=>{

})

3.設定後にnpm run devを再実行します

おすすめ

転載: blog.csdn.net/SmartJunTao/article/details/108056769