Giter Club home page Giter Club logo

vue-flatpickr's Introduction

vue-flatpickr (for VueJS 2.0)

A Vue component that wraps the Flatpickr.

Demo: https://jrainlau.github.io/vue-flatpickr/

Check out the master branch to view the vue-flatpickr for VueJS 1.0

Install

npm install vue-flatpickr

Usage

Enter one of your .vue file, load the instance VueFlatpickr-en.vue (or VueFlatpickr-zh for Chinese), and the stylesheet flatpickr.min.css.

Note that you have set the path correctly. For example, you might set the path as ../node_modules/vue-flatpickr/vue-flatpickr-default.vue and so on.

<template>
  <Flatpickr />
</template>

<script>
import Flatpickr from './vue-flatpickr-default.vue'

export default {
  components: {
    Flatpickr
  }
}
</script>

Options

Use props to pass the options object to vue-flatpickr. The options are same to the official document. And you could pass a default message to the instance by the props message. Here is an example below:

<!-- template -->
<Flatpickr :message='msg' :options='options' />

<!-- script -->
data () {
    return {
      msg: 'Click here to pick a date.',
      options: {
        allowInput: true
      }
    }
  }

Data binding

The <Flatpickr /> tag could be use as a normal <input> tag, your root component could use v-on:update='your_methods' to receive the data comes from <Flatpickr />.

<!-- template -->
<Flatpickr @update='update'/>

<!-- script -->
data () {
    return {
      msg: 'Click here to pick a date.'
    }
  },
methods: {
    update (val) {
      this.msg = val
    }
  }

Themes

vue-flatpickr supports all the offical themes, all you need to do is to pick up the one you like:

  • vue-flatpickr-default.vue
  • vue-flatpickr-airbnb.vue
  • vue-flatpickr-base16.vue
  • vue-flatpickr-confetti.vue
  • vue-flatpickr-dark.vue
  • vue-flatpickr-material_blue.vue
  • vue-flatpickr-material_green.vue
  • vue-flatpickr-material_orange.vue
  • vue-flatpickr-material_red.vue

Lisense

MIT

vue-flatpickr's People

Contributors

jrainlau avatar alvyre avatar sidkwok avatar aldoromo88 avatar

Watchers

James Cloos avatar Afrian Junior avatar

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.