凡科建站官网需要什么,wordpress右侧,图片处理软件,盛大游戏优化大师大概就是这样的咯#xff0c;文件展示到页面上#xff0c;点击文件下载并预览该文件#xff1b; 通过点击事件handleDownLoad(file.path)#xff0c;file.path为文件的地址#xff1b;
view classfilesview classcont v-for(…大概就是这样的咯文件展示到页面上点击文件下载并预览该文件 通过点击事件handleDownLoad(file.path)file.path为文件的地址
view classfilesview classcont v-for(file, index) in dataInfo.experience :keyindex clickhandleDownLoad(file.path)image:srcfile.path.split(.)[1] word ? /static/images/icons/icon_word.png : /static/images/icons/icon_pdf.pngmodescaleToFill/text{{ file.filename }}/text/view
/view 功能代码
// 文件下载
const handleDownLoad (path: string) {if (!path) return;Loading(加载中);uni.downloadFile({url: fullUrl(path),//完整地址success: res {if (res.statusCode 200) {uni.getFileSystemManager().saveFile({tempFilePath: res.tempFilePath,success: function (res1) {const savedFilePath res1.savedFilePath;HideLoading();// 打开文件uni.openDocument({filePath: savedFilePath,success: function (res2) {console.log(res2);}});}});} else {Toast(下载失败, {icon: error});}}});
};
样式的话大家根据自己需求写吧我只功能代码展示出来就可以了