Vue application elementUI upload component upload (picture, pdf) preview problem?

problem description

clipboard.png

use the upload upload component of elementUI to upload (picture, pdf) click how to achieve the preview function?

tried the method

try to use the browser function to do local preview ie has a compatibility problem with blob, how do you deal with it?

related codes

 handlePreview(file) {
    const userAgent = navigator.userAgent;
    if (!!window.ActiveXObject || "ActiveXObject" in window) {
        alert("")
    }else{
      window.open(file.url) //blob
    }
  }
Jun.15,2021

does not understand what you mean


if(file.includes('.pdf')){
    let url = file.url;
    const elink = document.createElement('a');
    elink.href = basePdfUrl + encodeURIComponent(url); //basePdfUrl pdf.js
    elink.target= '_block';
    document.body.appendChild(elink);
    elink.click();
    document.body.removeChild(elink);
}else{
    ...
}

this is how I solved it. It is compatible with ie and pdf.js plug-in to realize the preview of pdf

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e51540-4511b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e51540-4511b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?