<a-modal
:visible="isVisible”
style="top: 88px"
width=“90%"
:footer="null"
@cancel=“isVisible = false"
:maskClosable="false"
>
<iframe
class="filename"
:src="previewFileUrl”
width="100%"
height="600"
frameborder="1"
></iframe>
</a-modal>
// 点击预览教材
const previewFile = (record) => {
previewFileUrl = "";
const lastIndexOf = record.txtbook.lastIndexOf(".");
const type = record.txtbook.substring(lastIndexOf);
if ([".ppt", ".pptx", ".doc", ".docx"].includes(type)) {
state.previewFileUrl = `https://view.officeapps.live.com/op/view.aspx?src=${record.txtbook}&wdHideHeaders=True`;
} else {
// 预览PDF文件
state.previewFileUrl = `${record.txtbook}`;
}
state.isVisible = true;
};```
预览PDF、PPT、Word等文件
最新推荐文章于 2024-07-09 13:23:07 发布