An open API service indexing awesome lists of open source software.

https://github.com/lei1248276/vue-use-print

Vue3 based browser local printing or async template printing(基于vue3的浏览器局部打印或模板/异步模板打印)
https://github.com/lei1248276/vue-use-print

local-print print template-print typescript vue3

Last synced: about 1 month ago
JSON representation

Vue3 based browser local printing or async template printing(基于vue3的浏览器局部打印或模板/异步模板打印)

Awesome Lists containing this project

README

        

# vue-use-print
Vue based browser local printing or async template printing(基于vue的浏览器局部打印或模板/异步模板打印)

## Preview
- [vue3-use-print](https://use-print.vercel.app)
- [vue3-use-print -- 国内网址](https://print.osrc.com)

## Install
```bash
yarn add vue3-use-print
```

## Usage
```typescript
/**
* @param dom DOM元素
* @param options.before 打印之前回调
* @param options.after 打印之后回调
*/
export default function usePrint(
dom: HTMLElement,
options?: {
before?: Function;
after?: Function;
}
): void;
/**
* @param component vue组件
* @param props 组件props
* @param options.before 打印之前回调
* @param options.after 打印之后回调
* @param options.timeout 打印超时时间
*/
export default function usePrint(
component: ReturnType,
props?: Record,
options?: {
before?: Function;
after?: Function;
timeout?: number;
}
): void;
```

```vue

import { shallowRef, defineAsyncComponent } from 'vue'
import usePrint from 'vue3-use-print'
import LocalTemp from './template/LocalTemp.vue'
import ComponentTemp from './template/ComponentTemp.vue'
const AsyncCompTemp = defineAsyncComponent(() => import('./template/AsyncCompTemp.vue'))

const localTempRef = shallowRef()



local print(局部打印)





component print(模板打印)



async print(异步模板打印)


```