• Stars
    star
    515
  • Rank 85,879 (Top 2 %)
  • Language Vue
  • License
    MIT License
  • Created over 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

📅 A calendar component for vue3.0. Support gesture sliding, range selection, according to the week switch...

mpvue-calendar logo

Downloads Version License

mpvue-calendar

A feature-rich calendar component, support multiple modes and gesture sliding. For vue 3.0+

mpvue-calendar preview

💻 Install

mpvue-calendar only support [email protected]+

npm i mpvue-calendar -S

🔨 Usage

<Calendar
  backgroundText
  class-name="select-mode"
  :remarks="remarks"
/>

import { ref } from 'vue'
import Calendar from 'mpvue-calendar'

export default {
  components: {
    Calendar,
  },
  setup() {
    const remarks = ref({'2021-1-13': 'some tings'})

    return {
      remarks,
    }
  }
}

⚙️ API

name type default description
selectMode String 'select' For the selection mode of calendar component, can be used by 'select', 'multi','range', 'multiRange' mode
mode String 'month' Configure calendar display mode, the modes has 'month', 'week','monthRange'
selectDate String / String[] / {start: String; end: String} / {start: String; end: String} [] In different selection modes, there are use different types. String type for select mode, String[] type for multi mode, {start: String; end: String} type for range mode, and {start: String; end: String} [] type for multiRange mode.
monthRange String[] If you use monthRange mode, you need to set the content of the month to be displayed. for example [2021-1, 2021-2, 2021-6, 2021-9]
remarks Object Create remark for a day, key is date string, and value is remark content. for example { '2021-1-13': 'some things' }
tileContent Object Create tile content for a day, key is date string, and value is object, object have className and content. for example { '2021-1-5': { className: 'tip-class', content: 'some tip' } }
holidays Object Custom holiday information, for example {'2021-1-1': 'New Year'}
completion Boolean false Complete the calendar table with 6 lines
useSwipe Boolean true The mobile terminal supports gesture sliding to switch calendar
arrowLeft String Left arrow image url of toolbar
arrowRight String Right arrow image url of toolbar
monFirst Boolean false The first day of the week begins on Monday
backgroundText Boolean false Displays the background text of the current month calendar
language String use 'en' or 'cn' language
format (year, month) => [String, String] Format the date display at the header. you need return a array, the contents of the array are year and month
weeks String[] Weekly display content of custom header, for example ['S', 'M', 'T', 'W', 'T', 'F', 'S']
begin String Set the available date of the start, and the date before it will be disabled, for example '2021-1-5'
end String Set the available date of the end, and the date after it will be disabled, for example '2021-2-5'
disabled String[] Disable certain dates , for example ['2021-1-9', '2021-2-5']

Chinese lunar

If you need show chinese lunar, you need import lunar module.

<Calendar
  :lunar="lunar"
/>

import lunar from 'mpvue-calendar/dist/lunar'
export default {
  ...,
  setup() {
    return {
      lunar,
    }
  }
}

⚙️ methods

name type description
onSelect (selectDate) => void This function is triggered when the date is selected
onMonthChange (year, month, day) => void The callback is triggered when the month is change
next (year, month) => void Callback this method when triggered next month
prev (year, month) => void Callback this method when triggered prev month
setToday ref method Back today, you need to pass the ref parameter to call the internal method

More Repositories

1

Timetable

📆 timetables.js plugin, timetable schedule school-timetable 课程表 大学课表 日程表 插件
JavaScript
217
star
2

my-blog

🐬 个人技术博客(基于vue的服务端渲染 nuxt.js)
JavaScript
102
star
3

blog-server

基于koa2的服务端,vue的后台管理系统 🌐
JavaScript
58
star
4

chat-react

💬 The chat UI component for React
JavaScript
53
star
5

arc-progress

🐳 Arc circular animation progress bar drawn by canvas, you can used in the react component, or no dependence.
TypeScript
49
star
6

build-react

🛠️ build-react react-cli 构建react项目的脚手架工具
JavaScript
34
star
7

Mavatar

avatar upload for mobile 移动端头像上传插件 Mavatar.js
JavaScript
31
star
8

LiveNode

node web service 基于node的web服务生成脚手架工具
JavaScript
28
star
9

gulp-push

一行gulp命令完成编译并push文件到代码仓库
JavaScript
13
star
10

redux-order

redux middleware asyn promise 简化redux的异步流控制处理的中间件
JavaScript
7
star
11

gulp

gulp压缩文件,自动刷新
JavaScript
7
star
12

vue-imageClip

vue image clip 基于vue的图片裁剪组件
Vue
6
star
13

react-project-Instructions

react项目说明
JavaScript
6
star
14

utils

javascript utils helpers
JavaScript
3
star
15

react-template

react-cli project template
JavaScript
2
star
16

react-number-animate

react number animate text animation
1
star
17

qr-call-webpack-plugin

A webpack plugin of Call the terminal to output QR code through the browser console
JavaScript
1
star
18

hanlibrary

some files
1
star
19

build2webpack

webpack build react
JavaScript
1
star
20

livenode-cli

node web service cli
JavaScript
1
star
21

eslint-plugin-fly

eslint-plugin
JavaScript
1
star