Giter Site home page Giter Site logo

vuepdflook's Introduction

Install

npm install vueshowpdf -D

Quick Start

//template
调用的时候使用
<button @click="showPdffun">展示PDF</button>
 <vuepdflook @closepdf="closepdf" v-model="isshowpdf" :pdfurl="pdfurls" @pdferr="pdferr" :maxscale='4' :minscale='0.6' :scale='1.1' ></vuepdflook>
 

 /*
 如果想要兼容IE就进行如下操作:
 首先
 npm i -D babel-polyfill;
 然后;
在webpack.base.conf.js的入口处需改如下;
 entry: {
    app:["babel-polyfill", "./src/main.js"]
  },
 
 */
//javascript
import vuepdflook from 'vuepdflook'

export default {
    data:{
        return:{
             pdfurls:'//cdn.mozilla.net/pdfjs/tracemonkey.pdf',
             isshowpdf:false
        }
       
    },
    methods:{
        closepdf(){
            this.isshowpdf = false
        },
        pdferr(errurl) {
            console.log(errurl);
        },
        showPdffun(){
          this.isshowpdf = true;
        },
    },
    components:{
        vuepdflook
    }

 }

参数说明

  • closepdf 是关闭pdf的时候的出发的函数
  • v-model 是否显示pdf
  • pdfurl pdf的文件地址
  • pdferr 文件地址解析错误时触发的函数 返回错误的pdf地址
  • maxscale 最大放大倍数 默认 2
  • minscale 最小放大倍数 默认 0.8
  • scale 默认放大倍数 默认1.2

vuepdflook's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

artcas

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.