axios file stream downloads

the this .axios 
        .post ( the this .baseUrl + "/ exportUser", {ADMIN: "", Keys: "", keyword: the this .keyword,}, {responseType: 'BLOB' }) 
        .then ( function (Response) {
           var = BLOB new new Blob ([response.data])
           var downloadElement = document.createElement ( 'a' );
        var the href = window.URL.createObjectURL (BLOB); // create a download link 
        downloadElement.href = the href; 
        downloadElement.download = 'user data .xlsx'; // after downloading the file name 
        document.body.appendChild (downloadElement);
        downloadElement.click (); Download 
        document.body.removeChild (downloadElement); // Download the complete removal of elements 
        window.URL.revokeObjectURL (href); // freed blob objects 
          console.log (the Response); 
        }) 
        . the catch ( function (error) { 
          the console.log (error); 
        }); //
          

 

Guess you like

Origin www.cnblogs.com/1234wu/p/11166121.html
Recommended