1.5.0 • Published 6 years ago

vue-multi-date-picker v1.5.0

Weekly downloads
219
License
-
Repository
github
Last release
6 years ago

vue-multi-date-picker

Demo

A date picker for vue2.x support multi selection

Build Setup

# clone
git clone git@github.com:zhaokuohaha/vue-multi-date-picker.git
cd vue-multi-date-picker

# install dependencies
npm install

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

# build for production with minification
npm run build

Property

propertytypedefaultscomment
modelArray (multi = true) , Date (multi = false)-the model of date picker
multiBooleantrueuse multi select
dispArray'日', '一', '二', '三', '四', '五', '六','年', '月', '取消', '确定'Customize display text. The order of array must strict
langString'zh'Set to 'en' to translate to english
formatFunctionfunction (date) { return date.toLocaleDateString(); }Accepts a function with a date argument and returns a string
always-displayBooleanfalseAlways display the date picker

Usage

Notice: selected dates are UTC formatted

Manually

  1. Copy /src/lib/multiDatePicker.vue to your project

  2. Use as component

<template>
  <div>
    <m-date-picker v-model="date" :multi="multi" :always-display="false" :format="formatDate"></m-date-picker>
  </div>
</template>

<script>
  import mDatePicker from 'path/to/multiDatePicker'
  export default {
    data () {
      return {
        multi: true,
        date: []
      }
    },
    components: {
      'm-date-picker': mDatePicker
    },
    methods: {
      formatDate(date) {
        return data.toLocaleDateString();
      }
    }
  }
</script>

npm

  1. Install
npm install -S vue-multi-date-picker
  1. Use plugin
// main.js
import mDatePicker from 'vue-multi-date-picker'
// ...
Vue.use(mDatePicker)
<!-- your component -->
<template>
  <div>
    <m-date-picker v-model="date" :multi="multi" :always-display="false" :format="formatDate"></m-date-picker>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        multi: true,
        date: []
      }
    },
    methods: {
      formatDate(date) {
        return data.toLocaleDateString();
      }
    }
  }
</script>

For detailed explanation on how things work, consult the docs for vue-loader.

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago