antd vue 模拟浏览器无法显示

问题遇到的现象

antd vue 使用history模式。

const createRouter = () =>
  new Router({
    mode: 'history',
    routes: constantRouterMap
  })

Nginx已经配置了。

....
try_files $uri $uri/ /index.html
....

在浏览器上查看啥啥都是正常的。可以正常操作,但是使用ApiPost所有接口都显示异常

ApiPost里显示如下:

img

我想要达到的结果 能正常在apiPost显示前端啊页面标签,可以预览,如下

img

主要原因是nginx配置异常,没有正确配置后端服务代理地址。
解决:

  需要在nginx中配置转发访问后端的具体地址。

#后端服务代理配置

location ^~ /api/ { #api:后端服务代理路径(根据项目实际情况配置)
proxy_pass http://localhost:3000/; #后端服务真实地址
}