项目作者: weifeiyue

项目描述 :
A Beautiful Datepicker Component For Vue2
高级语言: Vue
项目地址: git://github.com/weifeiyue/vue-datepicker-local.git
创建时间: 2017-10-10T07:55:35Z
项目社区:https://github.com/weifeiyue/vue-datepicker-local

开源协议:MIT License

下载


vue-datepicker-local

A Beautiful Datepicker Component For Vue2

  • Lightweight (less than 5kb minified and gzipped)
  • Only dependencies Vue
  • Beautiful!

image

Demo

https://weifeiyue.github.io/vue-datepicker-local/

Usage

Install

  1. $ npm install vue-datepicker-local

ES6

  1. <template>
  2. <vue-datepicker-local v-model="time" ></vue-datepicker-local>
  3. </template>
  4. <script>
  5. import VueDatepickerLocal from 'vue-datepicker-local'
  6. export default {
  7. components: {
  8. VueDatepickerLocal
  9. },
  10. data () {
  11. return {
  12. time: new Date()
  13. }
  14. }
  15. }
  16. </script>

Browser globals

The dist folder contains vue-datepicker-local.js and vue-datepicker-local.css.

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="path/to/vue-datepicker-local.css">
  5. </head>
  6. <body>
  7. <div id="app">
  8. <vue-datepicker-local v-model="time"></vue-datepicker-local>
  9. </div>
  10. <script src="path/to/vue.js"></script>
  11. <script src="path/to/vue-datepicker-local.js"></script>
  12. <script>
  13. new Vue({
  14. el: "#app",
  15. data: {
  16. time: new Date()
  17. }
  18. })
  19. </script>
  20. </body>
  21. </html>

Props

Prop Description Type Default
v-model dates to be manipulated Date/Array
name name for input String
type type for input (inline/normal) String normal
inputClass custom class name for input String
popupClass custom class name for popup String
disabled determine whether the DatePicker is disabled Boolean false
clearable clear the date Boolean false
rangeSeparator range separator String “~”
format to set the date format String “YYYY-MM-DD”
local the local of the DatePicker Object {
dow: 1, // Monday is the first day of the week
hourTip: ‘选择小时’, // tip of select hour
minuteTip: ‘选择分钟’, // tip of select minute
secondTip: ‘选择秒数’, // tip of select second
yearSuffix: ‘年’, // format of head
monthsHead: ‘1月2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月’.split(‘‘), // months of head
months: ‘一月二月三月四月五月六月七月八月九月十月十一月十二月’.split(‘‘), // months of panel
weeks: ‘一日’.split(‘_’), // weeks
cancelTip: ‘取消’, // default text for cancel button
, submitTip: ‘提交’ // default text for submit button
}
disabledDate specify the date that cannot be selected Function (time, format)=>{return false}
showButtons show Cancel/Submit buttons Boolean false
placeholder placeholder of Input String

Events

Event Name Description Parameters
confirm triggers when user confirms the value component’s binding value
cancel triggers when user click the cancel button
clear triggers when user click the clear button

License

vue-datepicker-local is licensed under The MIT License.