文件预览展示
接口请求,处理返回文件流转换为 Blob对象
// 预览图片 或者pdf格式文件
getViewImg(id: string) {
return this.http.get(`/workflow/attachment/viewImg/${
id}`, {
observe: 'response',
responseType: 'blob'
});
}
// 预览word文件或Excel文件
getViewFile(id: string) {
return this.http.get(`/workflow/attachment/view/${
id}`, {
observe: 'response',
responseType: 'blob'
})
}
预览实现ts代码
// 附件预览
handlePreviewClick(item: any) {
if (!this.isPreviewModalVisible) {
this.changeIsSpinning.