Skip to content

Commit

Permalink
fix: excel src为空的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
501351981 committed Mar 4, 2024
1 parent d25cc87 commit e0ded38
Show file tree
Hide file tree
Showing 16 changed files with 340 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/packages/js-excel/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@js-preview/excel",
"type" :"module",
"version": "1.6.4",
"version": "1.6.5",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
4 changes: 4 additions & 0 deletions core/packages/js-excel/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ class JsExcelPreview {
return new Promise(((resolve, reject) => {
getData(src, this.requestOptions).then((res)=>{
this.renderExcel(res).then(resolve).catch(e =>{
this.mediasSource = [];
this.workbookDataSource = {
_worksheets:[]
};
this.xs.loadData({});
reject(e);
});
Expand Down
2 changes: 1 addition & 1 deletion core/packages/vue-excel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-office/excel",
"version": "1.6.4",
"version": "1.6.5",
"description": "",
"main": "lib/index.js",
"files": [
Expand Down
9 changes: 9 additions & 0 deletions core/packages/vue-excel/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ export default defineComponent({
ctx = canvas.getContext('2d');
if (props.src) {
getData(props.src, props.requestOptions).then(renderExcel).catch(e => {
mediasSource = [];
workbookDataSource = {
_worksheets:[]
};
xs.loadData({});
emit('error', e);
});
Expand All @@ -152,7 +156,12 @@ export default defineComponent({
emit('error', e);
});
} else {
mediasSource = [];
workbookDataSource = {
_worksheets:[]
};
xs.loadData({});
emit('error', new Error('src属性不能为空'));
}
});
function save(fileName){
Expand Down
1 change: 1 addition & 0 deletions examples/dist/assets/DocxDemo-2df115d0.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/ExcelDemo-f5b22377.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsDocxDemo-2c03f587.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsExcelDemo-cd3db580.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/dist/assets/JsPdfDemo-6551e883.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions examples/dist/assets/PdfDemo-09de85a7.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions examples/dist/assets/PreviewWrapper-b40c1f1a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e0ded38

Please sign in to comment.