一站式
提供docx、xlsx、pdf 3种文档的在线预览方案
diff --git a/docs/guide/faq.md b/docs/guide/faq.md index 8ae5983..9c12343 100644 --- a/docs/guide/faq.md +++ b/docs/guide/faq.md @@ -64,3 +64,34 @@ app.listen(3000); - 检查文件是否返回成功,是否存在跨域 - 目前不支持doc、xls格式文件的预览 - 可以看看@error事件,抛出了什么错误信息 + + +## ue.defineComponent is not a function + +出现这个问题一般是通过CDN的方式加载了vue.js文件,且CDN中的vue版本和开发环境安装的vue版本不一致。 +- 问题确认 + +检查CDN中vue.js的版本 和 node_modules下的vue版本是否一致,**注意**:是node_modules下的真实安装的vue版本,而不是package.json中的vue版本。 + +- 出现原因 + +package.json中vue版本不是指定的固定版本,而是在版本前面带"^"或"~"符号,这里的含义是使用符合条件的新版本,而不是看到的这个版本。 +```json +{ + "vue": "^2.6.10" +} +``` + +- 解决方法 + +修改package.json中 vue 和 vue-template-compiler的版本,将前的"^"或"~"符号去掉,具体版本号和CDN中的vue版本保持一致。 +```json +{ + "vue": "2.6.10", + "vue-template-compiler": "2.6.10" +} +``` + +删除 package-lock.json 文件 和 node_modules中的全部包。 + +重新安装所有依赖,然后运行查看效果。 \ No newline at end of file diff --git a/examples/docs/404.html b/examples/docs/404.html index f9e87de..99a96af 100644 --- a/examples/docs/404.html +++ b/examples/docs/404.html @@ -12,7 +12,7 @@
404
But if you don't change your direction, and if you keep looking, you may end up where you are heading.
跨域需要后端配合解决,设置允许资源文件跨域访问。
跨域设置是否成功,可以看返回的响应头里面,是否有access-control-allow-origin字段
解决跨域有以下几种方式:
只需要在server或者静态文件对应的location中添加 add_header Access-Control-Allow-Origin *;
server {
+import{_ as A,c as E,o as I,O as C}from"./chunks/framework.935eb42c.js";const k=JSON.parse('{"title":"常见问题","description":"","frontmatter":{},"headers":[],"relativePath":"guide/faq.md"}'),s={name:"guide/faq.md"},i=C(`常见问题
跨域无法预览
跨域需要后端配合解决,设置允许资源文件跨域访问。
跨域设置是否成功,可以看返回的响应头里面,是否有access-control-allow-origin字段

解决跨域有以下几种方式:
- 修改nginx或者apache配置
只需要在server或者静态文件对应的location中添加 add_header Access-Control-Allow-Origin *;
shellserver {
add_header Access-Control-Allow-Origin *;
}
这种方式最简单,但是接口也跟着允许跨域了,如果你的文件只是在某个目录下,可以只针对具体配置设置允许跨域。
shellserver {
location /upload/ {
@@ -18,4 +18,9 @@ import{_ as A,c as E,o as I,O as C}from"./chunks/framework.935eb42c.js";const R=
}));
-app.listen(3000);
各种语言都类似,可以自行百度查询
文件预览不出来
- 检查文件是否返回成功,是否存在跨域
- 目前不支持doc、xls格式文件的预览
- 可以看看@error事件,抛出了什么错误信息
`,20),B=[i];function s(e,g,n,l,J,k){return I(),E("div",null,B)}const a=A(Q,[["render",s]]);export{R as __pageData,a as default};
+app.listen(3000);
各种语言都类似,可以自行百度查询
出现这个问题一般是通过CDN的方式加载了vue.js文件,且CDN中的vue版本和开发环境安装的vue版本不一致。
检查CDN中vue.js的版本 和 node_modules下的vue版本是否一致,注意:是node_modules下的真实安装的vue版本,而不是package.json中的vue版本。
package.json中vue版本不是指定的固定版本,而是在版本前面带"^"或"~"符号,这里的含义是使用符合条件的新版本,而不是看到的这个版本。
{
+ "vue": "^2.6.10"
+}
修改package.json中 vue 和 vue-template-compiler的版本,将前的"^"或"~"符号去掉,具体版本号和CDN中的vue版本保持一致。
{
+ "vue": "2.6.10",
+ "vue-template-compiler": "2.6.10"
+}
删除 package-lock.json 文件 和 node_modules中的全部包。
重新安装所有依赖,然后运行查看效果。
`,32),Q=[i];function B(e,n,l,g,a,t){return I(),E("div",null,Q)}const r=A(s,[["render",B]]);export{k as __pageData,r as default}; diff --git a/examples/docs/assets/guide_faq.md.c0a76c24.lean.js b/examples/docs/assets/guide_faq.md.c0a76c24.lean.js new file mode 100644 index 0000000..323909d --- /dev/null +++ b/examples/docs/assets/guide_faq.md.c0a76c24.lean.js @@ -0,0 +1 @@ +import{_ as A,c as E,o as I,O as C}from"./chunks/framework.935eb42c.js";const k=JSON.parse('{"title":"常见问题","description":"","frontmatter":{},"headers":[],"relativePath":"guide/faq.md"}'),s={name:"guide/faq.md"},i=C("",32),Q=[i];function B(e,n,l,g,a,t){return I(),E("div",null,Q)}const r=A(s,[["render",B]]);export{k as __pageData,r as default}; diff --git a/examples/docs/config/event.html b/examples/docs/config/event.html index 53446c8..42c564b 100644 --- a/examples/docs/config/event.html +++ b/examples/docs/config/event.html @@ -15,7 +15,7 @@ - diff --git a/examples/docs/config/index.html b/examples/docs/config/index.html index 06700fc..e8fe76a 100644 --- a/examples/docs/config/index.html +++ b/examples/docs/config/index.html @@ -36,7 +36,7 @@ password: '', //string, 加密pdf的密码 //更多配置参见 https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib.html }pdf渲染时可能会请求一些bcmap文件,这些文件默认从 https://unpkg.com/pdfjs-dist@3.1.81/ 加载,但是可能存在网络不通问题,如果遇到这种问题,可以将这些文件放到自己静态目录,然后修改该属性,告诉组件去这里请求bcmap文件。
涉及的文件存放在当前github项目中examples/public/cmaps目录下,可将cmaps目录复制到你的静态服务目录下,然后修改staticFileUrl为cmaps文件夹对应的父地址,必须已http或https开头,如 http://yourdomain/static/
- - @@ -34,8 +34,13 @@ })); -app.listen(3000);各种语言都类似,可以自行百度查询