A Vue.js Component for Time Selection within one Week

A Vue.js Component for Time Selection within one Week

Vue Scheduler A Vue.js component for time selection within one week

Vue Scheduler

A Vue.js component for time selection within one week

Breaking Changes

There are some breaking changes that you need to be aware of to migrate your application to 2.0.0.

Take a glance

Online Demo

Installation

npm i -S @duoa/vue-scheduler

Global Registration

import Vue from 'vue'
import VueScheduler from '@duoa/vue-scheduler'
// Because this components has its styles, you must also import the css file.
import '@duoa/vue-scheduler/dist/vue-scheduler.css'
import locale from '@duoa/vue-scheduler/locale/zh-cn'

Vue.use(VueScheduler, { locale })

Local Registration

import VueScheduler from '@duoa/vue-scheduler'
import '@duoa/vue-scheduler/dist/vue-scheduler.css'
import locale from '@duoa/vue-scheduler/locale/zh-cn'

// set locale globally
VueScheduler.setLocale(locale)

new Vue({
  el: '#app',
  components: {
    'scheduler': VueScheduler
  }
})

Usage

You may now use the <scheduler /> component.

<template>
  <scheduler v-model="selected" />
</template>
<script>
export default {
  data () {
    return {
      selected: {}
    }
  }
}
</script>

That's all you need to do!

Props

  • value / v-model {Object} binding value

  • accuracy {Number} accuracy indicates how many cells (parts) that consist of an hour. The default value is 1.

  • footer {Boolean} footer indicates whether there is a footer row in the table. The default value is true.

  • multiple {Boolean} Like the html <select>, multiple indicates whether user can select multiple ranges of time. The default value is false.

  • disabled {Boolean} If disabled is true, the value can not be change by user interation.

  • locale {Object} If locale is given, use this locale instead of the global one.

  • hourRange {Array} since v2.0.0 Specify a schedulable time range of a day. If you don't want to have 24 hour schedules, you can pass a number array with 2 number to this prop. For example, you just want a day from 8:00 to 22:00 to be schedulable, you can pass [8, 22] to it. The default value is [0, 23].

  • startOfWeek {Number} since v2.0.0 The first day of a week. 0 is Sunday, 1 is Monday, ... The default value is 1.

  • ignoreWeekend {Boolean} since v2.0.0 Whether Sat & Sun is invisible. The default value is false.

Events

  • change Emit when the value is changed.

Locales

VueScheduler uses en as default locale, and we also provide a zh-cn in the package. We also provide some ways to change the locale if you want to customize it globally or locally. Here is what the locale object contains.

const locale = {
  AM: 'AM',
  PM: 'PM',
  TIME_TITLE: 'TIME',
  WEEK_TITLE: 'DAY',
  WEEK_DAYS: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  HOURS: [
    '00:00', '01:00', '02:00', '03:00', '04:00', '05:00',
    '06:00', '07:00', '08:00', '09:00', '10:00', '11:00',
    '12:00', '13:00', '14:00', '15:00', '16:00', '17:00',
    '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'
  ],
  DRAG_TIP: 'Drag to select hours',
  RESET: 'Reset Selected'
}

Change the locale globally:

// set locale globally
VueScheduler.setLocale(locale)

Or change the locale locally:

<scheduler :locale="locale" v-model="value" />

Download Details:

Author: duoani

Demo: https://duoani.github.io/vue-scheduler/index.html

Source Code: https://github.com/duoani/vue-scheduler

vue vuejs javascript

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework. Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

Vue Native is a framework to build cross platform native mobile apps using JavaScript

Vue Native is a framework to build cross platform native mobile apps using JavaScript. It is a wrapper around the APIs of React Native. So, with Vue Native, you can do everything that you can do with React Native. With Vue Native, you get

How to Make a Simple Vue Custom Select Component

In this article, you’ll learn how to build a Vue custom select component that can be easily be styled using your own CSS. In fact, it’s the same component that we use in production on Qvault, and you can see it in action on the playground.

Creating a Custom Tooltip Component in Vue

There are plenty of libraries out there that will have you up and running with a good tooltip solution in minutes. However, if you are like me, you are sick and tired of giant dependency trees that have the distinct possibility of breaking at any time.

Vue ShortKey plugin for Vue.js

Vue-ShortKey - The ultimate shortcut plugin to improve the UX .Vue-ShortKey - plugin for VueJS 2.x accepts shortcuts globaly and in a single listener.