文件流转换为url


 /**  * 文件流转换为url  * @param {blob} data //文件流  */   export function getObjectURL(data) {   var url = null   if (window.createObjectURL !== undefined) { // basic     url = window.createObjectURL(data)   } else if (window.webkitURL !== undefined) { // webkit or chrome     try {       url = window.webkitURL.createObjectURL(data)     } catch (error) {       console.log(error)     }   } else if (window.URL !== undefined) { // mozilla(firefox)     try {       url = window.URL.createObjectURL(data)     } catch (error) {       console.log(error)     }   }   return url }
   本文出自于 转载请注明出处,否则会追究。