-
@@ -80,7 +80,32 @@ export default {
_this.fileText = reader.result
}
})
- }
+ },
+ downloadFile() {
+ if (this.fileSrc) {
+ let link = document.createElement('a')
+ link.href = this.fileSrc
+ link.target = '_blank'
+ link.download = this.type
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ } else {
+ this.$message.info("File download failed")
+ }
+ },
+ viewFile() {
+ if (this.fileSrc) {
+ let link = document.createElement('a')
+ link.href = this.fileSrc
+ link.target = '_blank'
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link)
+ } else {
+ this.$message.info("File preview failed")
+ }
+ },
},
}