1.1.0 • Published 5 years ago

@happyma/rm_calendar v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

rm-calendar

react mobile calendar

gif

注意

这个组件是基于@longlongago2/rm_calendar进行修改,
下面的readme也是@longlongago2/rm_calendar的

NPM

install

npm install @longlongago2/rm_calendar --save

usage

import React, { Component } from 'react';
import RMCalendar from '@longlongago2/rm-calendar';
import '@longlongago2/rm_calendar/dist/rm-calendar.css';

class App extends Component {
  render() {
    return (
      <RMCalendar
          defaultDate={new Date()}
          type="month"
          touch
          width="100%"
          locale="zh-cn"
          firstDayOfWeek={0}
          toolbar
        />
    );
  }
}

CDN

download

rm-calendar.zip (click to download)

usage

// css
<link rel="stylesheet" href="[path]/dist/rm-calendar.css">

// js
<script src="[path]/dist/rm-calendar.js"></script>

// html
<RMCalendar.default
    defaultDate={new Date()}
    type="month"
    touch
    width="100%"
    locale="zh-cn"
    firstDayOfWeek={0}
    toolbar
  />

API

props

PropsDescriptionTypeDefault
defaultDate默认时间Datenew Date()
type日历类型"month"|"week""month"
touch是否可滑动Boolentrue
width日历宽度String"100%"
locale语言区String"zh-cn"
firstDayOfWeek周起始日周日-周六0-60
schedule日程数据Array[]
toolbar顶部工具栏Boolentrue

events

EventsDescriptionUsage
onCellClick日期单元格点击事件(item) => {}
onPageChange翻页事件({ year, month }) => {}

methods

MethodsDescriptionParams
turnWeekNumToChar周数字转汉字,参数:0-6day :Integer
getDaysOfPerMonth获取每个月的天数,参数:日期date :Date
getDataOfHeader获取表头周数据, 参数:周起始日(0-6)firstDayOfWeek: Number
getComposeDaysOfBoard获取面板组成天数据,参数1:date日期,参数2:周起始日,参数3:查询部分-1:获取上月组成天数, 0:获取本月组成天数, 1:获取下月组成天数date: Date, firstDayOfWeek: Number, order: Number
getDataOfBoard获取面板所有日期数据,参数1:日期,参数2:周起始日date: Date, firstDayOfWeek: Number
getWeekRowOfBoard获取日期所在面板中的行数,参数1:日期,参数2:周起始日date: Date, firstDayOfWeek: Number
getComputedDataOfBoard获取合成日程表数据的日期面板数据,参数1:日期,参数2:周起始日期,日程表数据date: Date, firstDayOfWeek: Number, schedule: Array
dateToValid校正日期1900-2099,大于或小于正常数据范围自动纠正date: Date
1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago