@js-preview/docx
Advanced tools
Comparing version 1.6.0 to 1.6.1
{ | ||
"name": "@js-preview/docx", | ||
"type" :"module", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"clean": "rimraf lib", | ||
"copyReadme": "cp ../../../README.md README.md", | ||
"copyReadme": "cp ../../../help.md README.md", | ||
"copyType": "cp index.d.ts lib/index.d.ts", | ||
@@ -15,0 +15,0 @@ "copyCss": "cp ./index.css ./lib/index.css", |
155
README.md
@@ -7,7 +7,8 @@ # vue-office | ||
[《非Vue框架预览看这里》](https://501351981.github.io/vue-office/examples/docs/guide/js-preview.html) | ||
[《使用非Vue框架(原生js、React等)、或者Vue里面报错,看这里》](https://501351981.github.io/vue-office/examples/docs/guide/js-preview.html) | ||
## 功能特色 | ||
- 一站式:提供docx、pdf、excel多种文档的在线预览方案,有它就够了 | ||
- 一站式:提供word(.docx)、pdf、excel(.xlsx, .xls)多种文档的在线预览方案,有它就够了 | ||
- 简单:只需提供文档的src(网络地址)即可完成文档预览 | ||
- 体验好:选择每个文档的最佳预览方案,保证用户体验和性能都达到最佳状态 | ||
- 性能好:针对数据量较大做了优化 | ||
@@ -17,9 +18,9 @@ ## 安装 | ||
#docx文档预览组件 | ||
npm install @vue-office/docx vue-demi@0.13.11 | ||
npm install @vue-office/docx vue-demi@0.14.6 | ||
#excel文档预览组件 | ||
npm install @vue-office/excel vue-demi@0.13.11 | ||
npm install @vue-office/excel vue-demi@0.14.6 | ||
#pdf文档预览组件 | ||
npm install @vue-office/pdf vue-demi@0.13.11 | ||
npm install @vue-office/pdf vue-demi@0.14.6 | ||
``` | ||
@@ -40,7 +41,7 @@ 如果是vue2.6版本或以下还需要额外安装 @vue/composition-api | ||
<template> | ||
<vue-office-docx | ||
:src="docx" | ||
style="height: 100vh;" | ||
@rendered="rendered" | ||
/> | ||
<vue-office-docx | ||
:src="docx" | ||
style="height: 100vh;" | ||
@rendered="rendered" | ||
/> | ||
</template> | ||
@@ -55,15 +56,15 @@ | ||
export default { | ||
components:{ | ||
VueOfficeDocx | ||
}, | ||
data(){ | ||
return { | ||
docx: 'http://static.shanhuxueyuan.com/test6.docx' //设置文档网络地址,可以是相对地址 | ||
components:{ | ||
VueOfficeDocx | ||
}, | ||
data(){ | ||
return { | ||
docx: 'http://static.shanhuxueyuan.com/test6.docx' //设置文档网络地址,可以是相对地址 | ||
} | ||
}, | ||
methods:{ | ||
rendered(){ | ||
console.log("渲染完成") | ||
} | ||
} | ||
}, | ||
methods:{ | ||
rendered(){ | ||
console.log("渲染完成") | ||
} | ||
} | ||
} | ||
@@ -78,6 +79,6 @@ </script> | ||
<template> | ||
<div> | ||
<input type="file" @change="changeHandle"/> | ||
<vue-office-docx :src="src"/> | ||
</div> | ||
<div> | ||
<input type="file" @change="changeHandle"/> | ||
<vue-office-docx :src="src"/> | ||
</div> | ||
</template> | ||
@@ -90,20 +91,20 @@ | ||
export default { | ||
components: { | ||
VueOfficeDocx | ||
}, | ||
data(){ | ||
return { | ||
src: '' | ||
components: { | ||
VueOfficeDocx | ||
}, | ||
data(){ | ||
return { | ||
src: '' | ||
} | ||
}, | ||
methods:{ | ||
changeHandle(event){ | ||
let file = event.target.files[0] | ||
let fileReader = new FileReader() | ||
fileReader.readAsArrayBuffer(file) | ||
fileReader.onload = () => { | ||
this.src = fileReader.result | ||
} | ||
} | ||
} | ||
}, | ||
methods:{ | ||
changeHandle(event){ | ||
let file = event.target.files[0] | ||
let fileReader = new FileReader() | ||
fileReader.readAsArrayBuffer(file) | ||
fileReader.onload = () => { | ||
this.src = fileReader.result | ||
} | ||
} | ||
} | ||
} | ||
@@ -119,7 +120,7 @@ </script> | ||
<template> | ||
<vue-office-docx | ||
:src="docx" | ||
style="height: 100vh;" | ||
@rendered="rendered" | ||
/> | ||
<vue-office-docx | ||
:src="docx" | ||
style="height: 100vh;" | ||
@rendered="rendered" | ||
/> | ||
</template> | ||
@@ -134,25 +135,25 @@ | ||
export default { | ||
components:{ | ||
VueOfficeDocx | ||
}, | ||
data(){ | ||
return { | ||
docx: '' | ||
} | ||
}, | ||
mounted(){ | ||
fetch('你的API文件地址', { | ||
method: 'post' | ||
}).then(res=>{ | ||
//读取文件的arrayBuffer | ||
res.arrayBuffer().then(res=>{ | ||
this.docx = res | ||
components:{ | ||
VueOfficeDocx | ||
}, | ||
data(){ | ||
return { | ||
docx: '' | ||
} | ||
}, | ||
mounted(){ | ||
fetch('你的API文件地址', { | ||
method: 'post' | ||
}).then(res=>{ | ||
//读取文件的arrayBuffer | ||
res.arrayBuffer().then(res=>{ | ||
this.docx = res | ||
}) | ||
}) | ||
}) | ||
}, | ||
methods:{ | ||
rendered(){ | ||
console.log("渲染完成") | ||
}, | ||
methods:{ | ||
rendered(){ | ||
console.log("渲染完成") | ||
} | ||
} | ||
} | ||
} | ||
@@ -207,4 +208,5 @@ </script> | ||
<template> | ||
<vue-office-pdf | ||
<vue-office-pdf | ||
:src="pdf" | ||
style="height: 100vh" | ||
@rendered="renderedHandler" | ||
@@ -241,8 +243,10 @@ @error="errorHandler" | ||
## 赞助和微信交流 | ||
## 打赏支持 | ||
**_如果该项目确实帮助到了您_**,为您节省了时间,请您不吝赞助,请作者喝一杯秋天的奶茶,暖一暖冰冷的心吧,哈哈哈,优化项目真的都是用爱发电^_^,不能打赏的朋友麻烦帮点个免费的赞 | ||
**如果该项目帮您节省了开发时间**,可以请作者喝杯咖啡,加微信交个朋友,交流前端问题。不能打赏的朋友麻烦帮点个免费的赞 | ||
<img src="https://501351981.github.io/vue-office/examples/dist/static/wx.png" alt="赞助二维码" width="260"/> | ||
## 打赏50及以上可向作者索要源码(仅限自己项目使用,不能复制开源) | ||
<span style="color: red;">打赏的朋友欢迎**添加微信**</span>,交流前端开发中遇到的技术、问题和困惑。 | ||
@@ -255,8 +259,1 @@ | ||
### 恳请各位大佬不吝点赞,开源不易,感谢支持~~ | ||
## 我的其他库 | ||
- HowToCode:前端编程之道,探讨如何写出高质量的前端代码,总结前端编程的各种方法论、原则、思维模型等。[《前端编程之道》](https://github.com/501351981/HowToCode) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
2
535596
9464
249