Giter Site home page Giter Site logo

yuluyi / vue-datepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hilongjw/vue-datepicker

0.0 0.0 0.0 423 KB

calendar and datepicker component with material design for Vue.js

Home Page: http://hilongjw.github.io/vue-datepicker/demo.html

License: MIT License

Vue 100.00%

vue-datepicker's Introduction

vue-datepicker

calendar and datepicker component with material design for Vue.js

Demo

The demo page is HERE.

Screenshot

Requirements

Instllation

npm

$ npm install vue-datepicker

Usage

<script>
import myDatepicker from 'vue-datepicker'
export default {
  data () {
    return {
      starttime: '',
      endtime: '2016-01-19',
      testTime: '',
      multiTime: '',
      option: {
        type: 'day',
        week: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
        month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
        format: 'YYYY-MM-DD',
        placeholder: 'when?',
        inputStyle: {
          'display': 'inline-block',
          'padding': '6px',
          'line-height': '22px',
          'font-size': '16px',
          'border': '2px solid #fff',
          'box-shadow': '0 1px 3px 0 rgba(0, 0, 0, 0.2)',
          'border-radius': '2px',
          'color': '#5F5F5F'
        },
        color: {
          header: '#ccc',
          headerText: '#f00'
        },
        buttons: {
          ok: 'Ok',
          cancel: 'Cancel'
        },
        overlayOpacity: 0.5, // 0.5 as default
        dismissible: true // as true as default
      },
      timeoption: {
        type: 'min',
        week: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
        month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
        format: 'YYYY-MM-DD HH:mm'
      },
      multiOption: {
        type: 'multi-day',
        week: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'],
        month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
        format:"YYYY-MM-DD HH:mm"
      },
      limit: [{
        type: 'weekday',
        available: [1, 2, 3, 4, 5]
      },
      {
        type: 'fromto',
        from: '2016-02-01',
        to: '2016-02-20'
      }]
    }
  },
  components: {
    'date-picker': myDatepicker
  }
}
</script>
<template>
  <div class="card">
    <div class="row">
      <span>Departure Date:</span>
      <date-picker :time.sync="starttime" :option="option" :limit="limit"></date-picker>
    </div>
    <div class="row">
      <span>Return Date:</span>
      <date-picker :time.sync="endtime" :option="option"></date-picker>
    </div>
    <div class="row">
      <span>time:</span>
      <date-picker :time.sync="testTime" :option="timeoption"></date-picker>
    </div>
  </div>
  <div class="test">
    Departure Date:{{starttime}}
    <br> Return Date:{{endtime}}
    <br> test Date:{{testTime}}
  </div>
  <input type="time">
</template>

API

  • Option
  • type
  type: 'day' // 'min', 'multi-day'

  • format
format: 'YYYY-MM-DD HH:mm'
  • placeholder
placeholder: 'when?'
  • week
 week: ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su']
  • month
  month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August','September', 'October', 'November', 'December']
  • inputStyle
inputStyle: {
  'display': 'inline-block',
  'padding': '6px',
  'line-height': '22px',
  'font-size': '16px',
  'border': '2px solid #fff',
  'box-shadow': '0 1px 3px 0 rgba(0, 0, 0, 0.2)',
  'border-radius': '2px',
  'color': '#5F5F5F'
}
  • color
  color: {
    header: '#ccc',
    headerText: '#f00'
  }
  • buttons
buttons: {
  ok: 'OK',
  cancel: 'Cancel'
}
  • animate
  overlayOpacity: 0.5, // 0.5 as default
  dismissible: true // as true as default
  • limit
  • from sometime to sometime
limit: {
  type:'fromto',
  from:'2016-01-10',
  to:'2016-01-30'
}
  • weekdays
limit:{
  type: 'weekday',
  available: [1, 2, 3, 4, 5] 
}

prop

<date-picker :time.sync="starttime" :limit="limit"></date-picker>

License

The MIT License

vue-datepicker's People

Contributors

hilongjw avatar beenotung avatar ish- avatar biangbiang 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.