iframe
<iframe :src="fileURLOther"></iframe>
import axios from "axios";
data() {return {fileURLOther: "",url:'',id:''}
}methods:{openPDF() {axios({method: "get",url: this.url,//文件的urlparams: {fileId: this.id,//文件的id},responseType: "blob",// 设置返回类型}).then((res) => {let blob = new Blob([res.data], {type: "application/pdf;chartset=UTF-8",});this.fileURLOther = URL.createObjectURL(blob);});},
}
window.open
<el-button @click="openPDF"> 预览 </el-button>