fix: js-excel bug修复

This commit is contained in:
liyulin 2023-10-20 15:08:24 +08:00
parent 7db27466bd
commit 5093154a77
3 changed files with 8 additions and 10 deletions

View File

@ -235,22 +235,17 @@ export default {
<img src="https://501351981.github.io/vue-office/examples/dist/static/wx.png" alt="赞助二维码" width="260"/>
<span style="color: red;">打赏的朋友欢迎**添加微信**或者进入前端开发交流群</span>,交流前端开发中遇到的技术、问题和困惑。
<span style="color: red;">打赏的朋友欢迎**添加微信**</span>,交流前端开发中遇到的技术、问题和困惑。
>【<span style="color:red;">**仅添加**打赏过的用户,不定期删除屏蔽朋友圈的好友</span>(为什么打赏了才能微信问问题?那别人为什么要先付出时间去解答你的问题?都是成年人了,人与人之间是价值交换,不是单向付出)】
> [常见问题](https://501351981.github.io/vue-office/examples/docs/guide/faq.html)
<img src="https://501351981.github.io/vue-office/examples/dist/static/wxqrcode.png" alt="个人微信" width="260"/>
<img src="https://501351981.github.io/vue-office/examples/dist/static/qun.png" alt="前端群" width="260"/>
### 恳请各位大佬不吝点赞,开源不易,感谢支持~~
## 我的其他库
- v-focus-next一个Vue指令使用该指令后在表单中回车之后可以自动聚焦下一个表单元素大大提升表单填写的流畅性。
[《v-focus-next》](https://github.com/501351981/v-focus-next)
- HowToCode前端编程之道探讨如何写出高质量的前端代码总结前端编程的各种方法论、原则、思维模型等。[《前端编程之道》](https://github.com/501351981/HowToCode)

View File

@ -1,7 +1,7 @@
{
"name": "@js-preview/excel",
"type" :"module",
"version": "1.4.4",
"version": "1.4.5",
"description": "",
"main": "lib/index.js",
"files": [

View File

@ -67,7 +67,7 @@ class JsExcelPreview {
let swapFunc = this.xs.bottombar.swapFunc;
this.xs.bottombar.swapFunc = function (index) {
swapFunc.call(that.xs.bottombar, index);
that.sheetIndex = index + 1;
that.sheetIndex = index;
setTimeout(()=>{
that.xs.reRender();
renderImage(that.ctx, that.mediasSource,that.workbookDataSource._worksheets[that.sheetIndex], that.offset);
@ -100,7 +100,7 @@ class JsExcelPreview {
this.mediasSource = medias;
this.workbookDataSource = workbookSource;
this.offset = null;
this.sheetIndex = 1;
this.sheetIndex = 0;
clearCache();
this.xs.loadData(workbookData);
renderImage(this.ctx, this.mediasSource,this.workbookDataSource._worksheets[this.sheetIndex], this.offset);
@ -132,7 +132,10 @@ class JsExcelPreview {
preview(src){
return new Promise(((resolve, reject) => {
getData(src, this.requestOptions).then((res)=>{
this.renderExcel(res).then(resolve);
this.renderExcel(res).then(resolve).catch(e =>{
this.xs.loadData({});
reject(e);
});
}).catch(e => {
this.xs.loadData({});
reject(e);