<el-button @click="handleSee"></el-button>
<el-dialog title="预览" :visible.sync="dialogVisible" width="30%" class="dialog">
<iframe
:src="iframeUrl"
style="width: 100%; height: 83vh; overflow-y: auto; overflow-x: auto"
></iframe>
</el-dialog>
data() {
return {
iframeUrl: "", //iframe预览显示
dialogVisible: false, //弹出层是否显示
};
},
//接口请求
handleSee() {
yulan().then((res) => {
// console.log("打印返回的预览内容:", res);
var binaryData = [];
binaryData.push(res);
this.iframeUrl = window.URL.createObjectURL(
new Blob(binaryData, { type: "application/pdf" })
);
// console.log("pdf展示地址:", this.iframeUrl);
});
}