0.1.1 • Published 5 years ago

@dora-fe/print v0.1.1

Weekly downloads
4
License
ISC
Repository
-
Last release
5 years ago

@dora-fe/print

打印

Usage

<template>
  <div>
    <!-- 默认 -->
    <div class="box">
      <print printButton/>
    </div>

    <!-- 自定义打印内容、按钮 -->
    <div class="box">
      <print ref="print">
        <div>内容(页面、打印)</div>
      </print>
      <button @click="print">自定义打印触发按钮</button>
    </div>

    <!-- 自定义打印内容、按钮(隐藏打印内容) -->
    <div class="box">
      <div>内容(页面)</div>
      <print ref="print2" :visibleContent="false">
        <div>内容(打印)</div>
      </print>
      <button @click="print2">自定义打印触发按钮(隐藏打印内容)</button>
    </div>
  </div>
</template>

<script>
import Print from "@dora-fe/print";

export default {
  components: {
    Print
  },

  methods: {
    async print() {
      await this.$nextTick();
      this.$refs.print.print();
    },
    async print2() {
      await this.$nextTick();
      this.$refs.print2.print();
    }
  }
};
</script>