vue + element 实现在线预览pdf并进行打印
vue + element 实现在线预览pdf并进行打印element ui 实现在线预览pdf地址并打印 百度了看很多文档都说需要安装一些插件之类的问题 其实不需要 现在大多数的浏览器都支持打印和预览 很简单的一句代码实现1.添加打印按钮<el-button type="primary" @click="printBtn(scope.$index, scope.row)">打印<
·
vue + element 实现在线预览pdf并进行打印
element ui 实现在线预览pdf地址并打印 百度了看很多文档都说需要安装一些插件之类的问题 其实不需要 现在大多数的浏览器都支持打印和预览 很简单的一句代码实现
1.添加打印按钮
<el-button type="primary" @click="printBtn(scope.$index, scope.row)">打印</el-button >
- 添加打印事件 我的地址是后端生成的 直接带过去 使用window.open带过去并打开一个新页面
// 打印
printBtn(index, row) {
let gid = row.CheckID;
PDFPath({ gid }).then((res) => {
if (res.Code === 1000) {
this.url = res.Result;
window.open(this.url, '_blank');
}
});
},
- 实现打印预览
更多推荐
已为社区贡献4条内容
所有评论(0)