| | |
| | | <template> |
| | | <div class="viewer-image"> |
| | | <!-- 图片 --> |
| | | <el-image-viewer |
| | | v-if="img.visible" |
| | | :url-list="[img.url]" |
| | | infinite |
| | | teleported |
| | | @close="close" |
| | | /> |
| | | <el-image-viewer v-if="img.visible" :url-list="[img.url]" infinite teleported @close="close" /> |
| | | </div> |
| | | |
| | | <!-- 文档 --> |
| | | <cl-dialog |
| | | v-model="doc.visible" |
| | | :title="$t('文档预览')" |
| | | height="70vh" |
| | | width="80%" |
| | | :scrollbar="false" |
| | | > |
| | | <cl-dialog v-model="doc.visible" :title="$t('文档预览')" height="70vh" width="80%" :scrollbar="false"> |
| | | <div v-loading="doc.loading" class="viewer-doc"> |
| | | <iframe :ref="setRefs('docIframe')" :src="doc.url" /> |
| | | </div> |
| | |
| | | return true; |
| | | } |
| | | |
| | | // 文档预览 |
| | | if (['word', 'excel', 'ppt', 'pdf'].includes(type)) { |
| | | if (type === 'pdf') { |
| | | doc.visible = true; |
| | | doc.loading = true; |
| | | doc.url = `https://view.officeapps.live.com/op/view.aspx?src=${decodeURIComponent(url)}`; |
| | | // pdf.js viewer 路径(放在 public/pdfjs/) |
| | | doc.url = `/pdfjs/web/viewer.html?file=${encodeURIComponent(url)}`; |
| | | |
| | | nextTick(() => { |
| | | refs.docIframe.onload = () => { |
| | | doc.loading = false; |
| | | }; |
| | | }); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | // 文档预览 |
| | | if (['word', 'excel', 'ppt'].includes(type)) { |
| | | doc.visible = true; |
| | | doc.loading = true; |
| | | doc.url = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`; |
| | | |
| | | nextTick(() => { |
| | | refs.docIframe.onload = () => { |