[Vuejs]-Handle base64 file content into something viewable

0👍

Try download it:

async downloadPdf() {
    let res = await this.$store.dispatch('pdf/getBase64String')
    let base64String = res.status === 'ok' ? res.data : ''
    this.downloadUrl = 'data:application/pdf;base64,' + base64String
    // downloadUrl bind href on a button in my page
    open(this.downloadUrl);
    // or, if it is not encode
    open(btoa(this.downloadUrl));
}

Leave a comment