下载Excel,pdf,word并预览
发布于 4 年前 作者 liren 1710 次浏览 来自 分享

buttonclass’skblue_bg’data-urlhttps://www.xingtu-group.cn/sjg_xieyi/8_Prove.pdf"data-type"pdf"catchtap’downloadFile’下载</button

downloadFilefunction

consolelog);

let type ecurrentTargetdatasettype

let url ecurrentTargetdataseturl

// switch (type) {

// case “pdf”:

// url += ‘pdf’;

// break;

// case “word”:

// url += ‘docx’;

// break;

// case “excel”:

// url += ‘xlsx’;

// break;

// default:

// url += ‘pptx’;

// break;

// }

wxdownloadFile({

url url

successfunctionres

consolelogres

varPath restempFilePath //返回的文件临时地址,用于后面打开本地预览所用

wxopenDocument({

filePathPath

successfunctionres

consolelog’打开文档成功’

 

})

},

failfunctionres

consolelogres

 

})

 

},

2 回复

直接在线转成h5页面,在线浏览不是更好嘛

可以下载?

回到顶部