wms-antdvue/.svn/pristine/19/19064bc0feeb1cf8f0d2bd867cb009efcab394d3.svn-base
2024-11-07 16:33:03 +08:00

42 lines
1.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<div class="n-layout-page-header">
<a-card :bordered="false" title="打印场景"> json打印表格图片打印 </a-card>
</div>
<a-card :bordered="false" class="mt-4 proCard">
<a-space>
<a-button type="primary" @click="jsonPrint">打印表格</a-button>
<a-button type="primary" @click="imagePrint">打印图片</a-button>
</a-space>
</a-card>
</div>
</template>
<script lang="ts" setup>
import printJS from 'print-js';
function jsonPrint() {
printJS({
printable: [
{ name: '汪伟', email: '735869@gmail.com', phone: '186****5653' },
{ name: '雷秀英', email: '235656452@gmail.com', phone: '135****6536' },
{ name: '邹芳', email: '24586526@gmail.com', phone: '159****5869' },
],
properties: ['name', 'email', 'phone'],
type: 'json',
});
}
function imagePrint() {
printJS({
printable: [
'https://naive-ui-admin-docs.vercel.app/logo.png',
'https://naive-ui-admin-docs.vercel.app/logo.png',
],
type: 'image',
header: 'Multiple Images',
imageStyle: 'width:100%;',
});
}
</script>