vue-period
Vue-based time selection component
Screenshots
Install
Get source from npm or yarn.
# Npm$ npm install vue-period --save# Yarn (recommend)$ yarn add vue-period
Support UMD library and individual CSS file.
./lib/├── vue-period.js└── vue-period.css./src/├── /components/│ ├── period.vue│ └── period-part.vue├── /util/│ └── util.js└── index.js
// For ES6 module // Import from src code for debugging or self building;
And import CSS file:
;
Usage
<template> <div id="app"> <period :initStatus="[{ day: 1, start: 6, end: 10 }, { day: 2, start: 13, end: 13 }]" :isFormat="true" :customProperty="{ day: 'weekday', start: 'startHour', end: 'endHour' }" :periodClass="[]" @change="handleChange"> </period> </div></template>
name: 'app' { return week: } methods: { thisweek = week }
API
Props
Property | Description | Type | Default |
---|---|---|---|
initStatus | Initialize unselected boxes. | Array | [] |
isFormat | Format the returned data. | Boolean | true |
customProperty | Customize the key value for the returned data | Object | {day: 'day', start: 'start', end: 'end'} |
periodClass | Custom style | String/Array/Object | - |
Events
Event Name | Description | Return Value |
---|---|---|
change | Callback when clicking button or boxes. | [{day: '', start: '', end: ''}] |
Build Setup
# install dependenciesnpm install / yarn install# serve with hot reload at localhost:8080npm run demo:dev# build for demo with minificationnpm run demo:build# build for gh-pages with minificationnpm run demo:prepublish# build for production with minificationnpm run build
TODO
- Remove the dependency on element-ui
License
MIT