Applet open a document of the micro-channel function

/ * Open file 
* @param fileUrl: file address 
* @param filetype: File Type 
* / 
the openDocument (fileURL, filetype) { 
    wx.downloadFile ({ 
        URL: fileURL, 
        Success: RES => { 
            const filePath = res.tempFilePath; 
            WX .openDocument ({ 
                 filePath: filePath, 
                 fileType: filetype, 
                 success: function (RES) {
                     // console.log ( "document open success") 
                 }, 
                 Fail: function (RES) {
                    wx.showToast ({title: 'Failed to open document', icon: 'none', DURATION: 2000 }) 
                 }, 
            }) 
         }, 
         Fail: RES => { 
             the console.log (RES); 
         }, 
   }); 
}

 

Guess you like

Origin www.cnblogs.com/gufeibai/p/11824270.html