npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-easy-print

v1.0.0

Published

Use the vue component slot for template printing Use iframe to copy the print area

Readme

vue-easy-print

A print component that supports both Vue 2 and Vue 3.

中文文档

English

Core

Render the print template through a Vue slot. Copy the print area into an iframe and trigger the browser print flow.

Online demo

Updates

2026-03-13 ver 1.0.0

  • adds support for both Vue 2 and Vue 3
  • adds styleHTML props, thanks to mrliuc
  • removed unused props; print styles are now fully managed by the template.

2021 ver 0.0.7

  • fixes compatibility issues, thanks to Wizard67

Quick Start

Step 1

npm install vue-easy-print --save

Step 2: register the component in your Vue page

import vueEasyPrint from "vue-easy-print";
import demo from "./your path/demo";

export default {
    components: {
        vueEasyPrint,
        demo
    }
};

Step 3: provide the print template

<vue-easy-print tableShow>
    <template slot-scope="func">
        <demo :getChineseNumber="func.getChineseNumber"></demo>
    </template>
</vue-easy-print>

slot-scope

The default slot exposes the getChineseNumber helper, which converts a numeric amount into uppercase Chinese currency text.

Props

| Prop | Type | Default | Description | | --- | --- | --- | --- | | tableShow | Boolean | false | Controls whether the print area is displayed. | | buttonShow | Boolean | false | Controls whether the built-in print button is shown. | | buttonClass | String | el-button el-button--default | Class name applied to the built-in print button. | | beforeCopy | Function | - | Hook called before copying the print DOM, useful for preparing content. | | beforePrint | Function | - | Hook called before triggering browser print, useful for regenerating QR codes or similar content. | | styleHTML | String | - | No need to copy the project styles; just pass in a fixed style string. |

Methods

| Method | Parameters | Returns | Description | | --- | --- | --- | --- | | init | - | void | Initializes the print iframe and syncs styles into the print context. It runs automatically after mount. | | print | - | void | Starts the print flow. You can call it manually through a component ref, for example this.$refs.easyPrint.print(). | | getStyle | - | void | Collects page-level style and link tags and injects them into the print iframe. Usually no manual call is needed. | | getChineseNumber | currencyDigits | String | Converts a numeric amount into uppercase Chinese currency text for display in the template. |

Full Demo

Alt text

Code

<template>
    <div id="app">
        <button @click="printDemo">Test Print</button>
        <vue-easy-print tableShow ref="easyPrint">
            <!-- Write your own print template -->
            <!-- <template slot-scope="func">
                <demo :getChineseNumber="func.getChineseNumber"></demo>
            </template> -->
        </vue-easy-print>
    </div>
</template>

<script>
import vueEasyPrint from "vue-easy-print";
import demo from "./components/demo";

export default {
  name: "App",
  data() {
    return {
      tableData: {
        id: 998,
        store_name: "Test Store",
        created_at: "2018-06-06 15:21:35",

        detail: [
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          },
          {
            name: "Product A",
            item_unit: "40ML",
            item_size: "Bottle",
            item_quantity: 5,
            item_price: 188,
            pv: 150,
            item_total: 5 * 188,
            item_total_pv: 5 * 150
          }
        ]
      }
    };
  },
  methods: {
    printDemo() {
      this.$refs.easyPrint.print();
    }
  },
  components: {
    vueEasyPrint,
    demo
  }
};
</script>

License

MIT