先運行npm i @gauseen/nuxt-proxy -D html
再nuxt.config.js的module.exports 裏面添加以下代碼ios
modules:[ '@nuxtjs/axios', // 請求代理配置,解決跨域 '@gauseen/nuxt-proxy', ], // 代理服務器 proxyTable: { "/apis": { target: "http://xxx.con", // 線上地址 // target: "http://192.168.1.106:7000", // 本地環境 pathRewrite: {"^/apis" : ""} } },