4.1.2 • Published 2 years ago

@livelybone/vue-datepicker v4.1.2

Weekly downloads
645
License
MIT
Repository
github
Last release
2 years ago

@livelybone/vue-datepicker

NPM Version Download Month gzip with dependencies: 25kb typescript pkg.module

pkg.module supported, which means that you can apply tree-shaking in you project

中文文档

A vue component of datepicker, includes DatePicker, DatetimePicker, DateRangePicker, TimePicker

repository

https://github.com/livelybone/vue-datepicker.git

Demo

https://livelybone.github.io/vue/vue-datepicker/

Run Example

Your can see the usage by run the example of the module, here is the step:

  1. Clone the library git clone https://github.com/livelybone/vue-datepicker.git
  2. Go to the directory cd your-module-directory
  3. Install npm dependencies npm i(use taobao registry: npm i --registry=http://registry.npm.taobao.org)
  4. Open service npm run dev
  5. See the example(usually is http://127.0.0.1:3000/examples/test.html) in your browser

Installation

npm i -S @livelybone/vue-datepicker

Global name - The variable the module exported in umd bundle

VueDatepicker

Interface

See what method or params you can use in index.d.ts

Usage

import { Datepicker, Timepicker, DatetimePicker, DateRangePicker } from '@livelybone/vue-datepicker';

// Global register
Vue.component('datepicker', Datepicker);
Vue.component('timepicker', Timepicker);
Vue.component('datetime-picker', DatetimePicker);
Vue.component('date-range-picker', DateRangePicker);

// Local register
new Vue({
  components:{ Datepicker, Timepicker, DatetimePicker, DateRangePicker }
})

when you want to set this module as external while you are developing another module, you should import it like this:

import * as VueDatepicker  from '@livelybone/vue-datepicker'

// then use it by need

Use in html, see what your can use in CDN: unpkg

<-- use what you want -->
<script src="https://unpkg.com/@livelybone/vue-datepicker/lib/umd/<--module-->.js"></script>

Props

Common

NameTypeDefaultValueDescription
id[String, Number]none
value[String, Number]none
placeholderString请选择
minStringnoneMin
maxStringnoneMax
canEditBooleantrueIf it can be changed
inputStyleObjectnoneStyle of input tag
popperPropsObjectdefaultPopperPropsProps of module @livelybone/vue-popper
scrollbarPropsObject{ isMobile: false, maxHeight: 200 }Props of scrollbar, see vue-scrollbar-live
const defaultPopperProps = {
  arrowPosition: 'start',
  arrowOffsetScaling: 1,
  popperOptions: {
    placement: 'bottom-start',
    positionFixed: true,
    // more options in https://popper.js.org
  },
}

Datepicker

NameTypeDefaultValueDescription
dayStrArray['日', '一', '二', '三', '四', '五', '六']Used to set day name
monthStrArray['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']Used to set month name
multipleBooleanfalse
typeStringdateOptions: year,month,date
firstDayOfWeekNumber0Used to set the first day of week. Options: 0, 1, 2, 3, 4, 5, 6
btnStrString确定Used to set text of button

Timepicker

NameTypeDefaultValueDescription
typeStringsecondOptions: hour,minute,second
timeStrArray['时', '分', '秒']Used to set time name
btnStrString确定Used to set text of button

DatetimePicker

NameTypeDefaultValueDescription
dayStrArray['日', '一', '二', '三', '四', '五', '六']Used to set day name
monthStrArray['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']Used to set month name
timeStrArray['时', '分', '秒']Used to set time name
btnStrString确定Used to set text of button
firstDayOfWeekNumber0Used to set the first day of week. Options: 0, 1, 2, 3, 4, 5, 6
timeTypeStringsecondOptions: hour,minute,second

DateRangePicker

NameTypeDefaultValueDescription
valueArray[null, null]Used to set day name
dayStrArray['日', '一', '二', '三', '四', '五', '六']Used to set day name
monthStrArray['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']Used to set month name
btnStrString确定Used to set text of button
firstDayOfWeekNumber0Used to set the first day of week. Options: 0, 1, 2, 3, 4, 5, 6
secondPlaceholderString请选择结束
rangeSeparatorString

Events

NameEmittedDataDescription
inputString

style

For building style, you may need to import the css or scss file:

// scss
import 'node_modules/@livelybone/vue-datepicker/lib/css/index.scss'

// css
import 'node_modules/@livelybone/vue-datepicker/lib/css/index.css'

Or

// scss
@import 'node_modules/@livelybone/vue-datepicker/lib/css/index.scss'

// css
@import 'node_modules/@livelybone/vue-datepicker/lib/css/index.css'

Or, you can build your custom style by copying, editing and importing node_modules/@livelybone/vue-datepicker/lib/css/index.scss

QA

  1. Error Error: spawn node-sass ENOENT

You may need install node-sass globally, npm i -g node-sass

4.1.2-alpha

2 years ago

4.1.2

2 years ago

4.1.0

3 years ago

4.0.3

3 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

4.0.0-beta

4 years ago

3.1.1

4 years ago

3.1.0

5 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.8.0

5 years ago

2.7.1

5 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.3

5 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago