//router.js
const routes = [
{
path: '/',
name: 'homePage',
redirect: '/homePage'
},
{
path: '/print',
name: 'print',
component: () => import('@/views/print.vue')
},
]
/* 点击打印事件 跳转至打印页面 */
printEvent(index, row) {
let rowobj = {
createAccount: row.createAccount,
createName: row.createName,
}
let routeData = this.$router.resolve({
path: `/print`,
name: 'print',
query: {
printList: JSON.stringify(rowobj)
}
})
window.open(
routeData.href,
'blank',
'width=' +
(window.screen.availWidth - 20) +
',height=' +
(window.screen.availHeight - 90) +
',top=0,left=0,status=no, toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no,z-look=yes'
)
},
//print.vue
//接收传递的参数
this.$route.query.printList
//点击打印
doPrint() {
window.print()
}