跨域问题,通过 @nuxtjs/proxy 解决
// nuxt.config.js
modules: [
'@nuxtjs/proxy'
],
proxy: [
[
'/api/',
{
target: 'siteexample.com'
}
],
[
'/oauth2.0/',
{
target: 'siteexample.com'
}
]
]
referer 或 origin 问题,通过本地配置 host 解决
注意配 host 不包含端口号
// hosts
192.168.0.43 m.siteexample.com
nuxt 本地运行的 host 和 port 可在 package.json 中设置更改
// package.json
{
"config": {
"nuxt": {
"host": "192.168.0.43",
"port": "8980"
}
}
}
现在浏览器打开地址为 m.siteexample.com:8980/