PDF编辑vue怎样通过路由传参,通过获取传进来的参数
原创传参,pdf预览
vue 路由跳转,路由传参的几种方式
1.配置好路由
{
path: /Interation/CreditPDF, //路径
name: CreditPDF,
meta: {
requireAuth: true
},
component: () =>
import (@/views/credit/CreditPDF),//这里是文件所在的位置
},
-
路由跳转
2.1. router-link
2.2、$router方式跳转
2.2.1.传参和获取参数(1)
checkReport(){
const routeUrl = this.$router.resolve({
path: "/Interation/CreditPDF",//路径
query: {
orderSn:this.report.order,
reportSn:this.report.report
}
});
window.open(routeUrl.href, "_blank");
},
this.$router.push({
path: /Interation/CreditPDF,
query: {
name: name,
dataObj: this.msg
}
})
this.$router.push(/Interation/CreditPDF?code=123)
const orderSn = this.$route.query.orderSn
const reportSn = this.$route.query.reportSn
console.log(orderSn,reportSn,orderSn,reportSn);
2.2.2 传参和获取参数(2)
this.$router.push({
name: /Interation/CreditPDF,
params: {
name: name,
dataObj: this.msg
}
})
this.$router.params.参数名
pdf预览
1.下载
在官网下载pdfjs http://mozilla.github.io/pdf.js/getting_started/#download
2.放入项目
将解压后的pdf文件夹放在static目录下
将 2333.pdf
,的路径是 /static/2333.pdf
viewer.html
的路径是 /static/pdf/web/viewer.html
或者
出错的话试试这个
注释viewer.js的代码:
// if (fileOrigin !== viewerOrigin) {
// throw new Error(file origin does not match viewers);
// }
仅供学习参考
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
上一篇:装mysql的详细过程 下一篇:python面试技巧一