簡單寫一個下載的頁面
<router-link to="/pdf/download">
<el-button type="primary" @click="clickBtn">
下載pdf
</el-button>
</router-link>
methods: {
fetchData() {
import('./content.js').then(data => {
const { title } = data.default
document.title = title
this.article = data.default
setTimeout(() => {
this.fullscreenLoading = false
this.$nextTick(() => {
window.print()
})
}, 3000)
})
}
點擊下載
但是不知道為啥如果是加了一個target 就不能在新開的頁面 保存下載pdf