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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-booklet

v2.3.3

Published

Vue book-like compoment for create a your own e-book

Downloads

76

Readme

vue-booklet

Vue book-like compoment for create a your own e-book

Vue Booklet is a compoment which can let your create a flipable book fastly, and is responsive. As it's used css animation, it will not support IE 9 and other old browser.

Demo

http://book.sardo.work

Installation

npm install vue-booklet --save

or

yarn add vue-booklet

Usage

Import module from vue-booklet, then register it to Vue:

import booklet from 'vue-booklet';

new Vue({
  el: '#your-dom-element',
   components: {
      booklet
   }
})

And import the css file in your html file:

<link rel="stylesheet" href="vue-booklet.min.css">

After that, you can use vue-booklet on your project now.

Without webpack

<head>
  <link rel="stylesheet" href="vue-booklet.min.css">
</head>
<div id="app">
  <Book>
    <div class="page cover">
      <article class="content">
        <h1>My first book</h1>
      </article>
    </div>
    <div class="page">
      <article class="content">
        <h1>Hello World !</h1>
        <p>Using vue-booklet to create a book which can fliped.</p>
        <p>Please feel free to use it.</p>
      </article>
    </div>
  </Book>
</div>

<script type="text/javascript" src="http://vuejs.org/js/vue.min.js"></script>
<script type="text/javascript" src="vue-booklet.min.js"></script>
<script>
var VueBooklet = window.VueBooklet;

new Vue({
  el: '#vue-booklet-container',
  components: {
    Book: VueBooklet,
  }
})
</script>

Example

<Book>
  <div class="page cover">
    <article class="content">
      <h1>My first book</h1>
    </article>
  </div>
  <div class="page">
    <article class="content">
      <h1>Hello World !</h1>
      <p>Using vue-booklet to create a book which can fliped.</p>
      <p>Please feel free to use it.</p>
    </article>
  </div>
</Book>

If you want to add page to book programmatically, here are one more example:

const newPage = document.createElement('div');
const newContent = document.createElement('div');
newPage.className = 'page';
newContent.className= 'content';
newPage.appendChild(newContent);
pages.appendChild(newPage);

Methods

prevPage(), nextPage()

Function for control the book without button.

this.$refs.book.nextPage();
this.$refs.book.prevPage();

movePage(pageNum)

Function for allow user move to specify page.

const pageNumber = '1';
this.$refs.book.movePage(pageNumber);

Props

displayPageNumber(optional)

Default value is true. Will not show page number when it is false.

enableControl(optional)

Default value is true. Will not allow user control the book when it is false. If you want to control it, add ref to book compoment and call function like this:

this.$refs.book.nextPage();
this.$refs.book.prevPage();

displayButton(optional)

Default value is true. Will not show nextPage and PrevPage button when it is false. Only work when the value of allowFlip is true.

enableSelectPage(optional)

Default value is true. Will not allow user select page when it is false. Only work when the value of allowFlip is true.

langcode(optional)

Set the language of booklet UI. Current support language is English (en), Traditional Chinese (zh-hant) and Simplified Chinese (zh-hans). You can add new langcode with translation props. Default value is en.

translation(optional)

Define translation of booklet UI. You can pass object or JSON string with translated text to it. Default value:

{
  'en': {
    'selectPage': 'Select page',
    'pages': 'Pages',
    'prev': 'Prev',
    'next': 'Next',
  },
  'zh-hant': {
    'selectPage': '跳至指定頁數',
    'pages': '頁數',
    'prev': '上一頁',
    'next': '下一頁',
  },
  'zh-hans': {
    'selectPage': '跳至指定页数',
    'pages': '页数',
    'prev': '上一页',
    'next': '下一页',
  },
}

pageTransitionTime (optional)

Set the transition time of each book page.

Default value is 0.8s.

onOpened(book, position) (optional)

A callback which happens after book opened. Pass the book dom which you can control it, and position of book.

onClosed(book, position) (optional)

A callback which happens after book closed. Pass the book dom which you can control it, and position of book.

onFlipStart(currentPage, direction) (optional)

A callback which happens before a page filped. Pass the page dom which you can control it, and direction for you to know filped to next page or previous page.

onFlipEnd(currentPage, direction) (optional)

A callback which happens after a page filped. Pass the page dom which you can control it, and direction for you to know filped to next page or previous page.

Developing

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report