diff --git a/doc/source/doc.js b/doc/source/doc.js index fb8b7048..279cb171 100644 --- a/doc/source/doc.js +++ b/doc/source/doc.js @@ -108,7 +108,7 @@ const doc = (isDev, callback) => { // 组件文档 CATES.forEach((c) => { const components = getComponents(c.cate).filter((comp) => { - if (isDev && !/^KL(Sidebar|Menu|Button|Table|Select|MultiSelect)$/.test(comp)) { + if (isDev && !/^KL(Sidebar|Upload|Menu|Button|Table|Select|MultiSelect)$/.test(comp)) { return false; } diff --git a/src/js/components/widget/KLImagePreview/index.html b/src/js/components/widget/KLImagePreview/index.html index 2d6aca01..ca5eb680 100644 --- a/src/js/components/widget/KLImagePreview/index.html +++ b/src/js/components/widget/KLImagePreview/index.html @@ -15,7 +15,7 @@ {#list opList as op}
  • {#if (imageList[curIndex].status === 'success' || imageList[curIndex].status === undefined) && op.name === 'remove'} - + {#elseif op.name === 'zoomIn'} {parseInt(virtualInfo.scale * 100)}% diff --git a/src/js/components/widget/KLImagePreview/index.js b/src/js/components/widget/KLImagePreview/index.js index cbf2a973..2e12b427 100644 --- a/src/js/components/widget/KLImagePreview/index.js +++ b/src/js/components/widget/KLImagePreview/index.js @@ -348,6 +348,16 @@ const KLImagePreview = Component.extend({ minTranslateY: minDeltaY < 0 ? minDeltaY : 0, }; }, + downloadFile(file) { + const a = document.createElement('a'); + a.download = file.name; + fetch(file.src).then(res => res.blob().then((blob) => { + const blobUrl = window.URL.createObjectURL(blob); + a.href = blobUrl; + a.click(); + window.URL.revokeObjectURL(blobUrl); + })); + }, }); module.exports = KLImagePreview;