具体报错为:

在这里插入图片描述

Access to fetch at ‘http://172.27.103.7/G1/M00/00/44/rBtnB2LWJ5aAfsvXAA0Hygi9iws872.pdf’ from origin ‘http://172.27.101.43:10000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
pdf.js:26403

报错如上图所示

解决方案

nginx.conf中添加代理

 location /dijz-pdf/{
            proxy_pass   http://172.27.103.7/;
        }

在这里插入图片描述
前端得到的pdf路径进行修改
在这里插入图片描述
dijz-pdf这一部分或者**/dijz-pdf**和斜扛之前(包括dijz-pdf)的将会被 **http://172.27.103.7/**替换掉

GitHub 加速计划 / vu / vue-pdf
2.19 K
520
下载
vue.js pdf viewer
最近提交(Master分支:24 天前 )
a9f01b23 - 6 个月前
c188a043 add open_collective vue-pdf 7 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐