Giter Site home page Giter Site logo

vue-iframe-print's Introduction

vue-iframe-print

基于 iframe 打印的小工具,原版有些bug,修复了下

原版地址 vue-print-nb

安装

npm install vue-iframe-print --save
import Print from 'vue-iframe-print'

Vue.use(Print);

示例

在线打印示例

你也可以克隆下来本地跑一下

如果你需要扩展功能,可以联系我,或者自己本项目的源文件进行更改

使用姿势

打印整页

<button v-print>打印整页</button>

局部打印:

HTML:

<div id="printDiv">
    且随疾风前行,身后亦需流心
</div>

<button v-print="'#printDiv'">只打印指定 DOM</button>

局部打印扩展

HTML:

<div id="printDiv">
    且随疾风前行,身后亦需流心
</div>

<button v-print="printObj">只打印指定 DOM</button>

Vue JavaScript:

export default {
    data() {
        return {
            printObj: {
              id: "printDiv",
              popTitle: 'vue-iframe-print',
              extraCss: 'https://www.baidu.com/,https://www.baidu.com/',
              extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>'
            }
        };
    }
}

API

  • id: 打印的 ID
  • standard: 文档类型, 默认html5, 可选 html5, loose, strict
  • extraHead: 扩展头部
  • extraCss: 扩展 css
  • popTitle: 标题
  • endCallback(): 打印成功后回调

vue-iframe-print's People

Contributors

alexwjj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-iframe-print's Issues

图表打印

当页面中存在echarts图表时,别的都能打印,图表无法打印吗?
image
image

使用求助

你好,请问你这个demo的printObj怎么打印的啊,也没看见printObj,只看到了printDiv2
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.