1.0.6 • Published 3 years ago

react-h5-calendar v1.0.6

Weekly downloads
9
License
MIT
Repository
github
Last release
3 years ago

react-h5-calendar

简体中文 | English

造一个小轮子,核心文件不到三百行,一款基于 react 的移动端 , mobile, h5 日历展示组件

我这个只是精简版的日历 ,大而全的可参考 https://github.com/TangSY/react-hash-calendar

demo

demo

扫描二维码直接查看 demo

demo

直接打开浏览器查看 https://kokiy.github.io/react-h5-calendar/calendar

react 移动端日历组件

  1. 支持周视图,周日历
  2. 支持月视图,月日历
  3. 支持左右滑动切换月份
  4. 支持上下滑动切换日历视图
  5. 支持日历上打点标记
  6. 本项目基于dumi 构建和发布
  7. 基于dayjs处理日历逻辑

使用教程

yarn add react-h5-calendar

import { MobileCalendar } from 'react-h5-calendar'
export default class Demo extends Component {
  render() {
    return (
      <MobileCalendar
        onDateClick={date => this.setState({ currentDate: date.format('YYYY-MM-DD') })}
        currentDate={'2020-12-12'}
      />
    )
  }
}

参数设置

参数说明默认值
currentDate当前选择的日期 比如2020-12-12'当天'
showType展示类型支持monthweekmonth
transitionDuration切换日期的动画过渡时间0.3
onDateClick日期点击回调() => {}
onTouchStart滑动开始回调() => {}
onTouchMove滑动过程中回调() => {}
onTouchEnd滑动结束回调() => {}
markType标记类型 支持dotcircledot
markDates需要标记的日期数组[]
disableWeekView禁用周视图false

markDates 参数说明

const markDates = [
  { color: '#459', date: '2020-12-12', markType: 'circle' },
  { color: '#a8f', markType: 'dot', date: '2020-12-23' },
  { color: '#a5f', markType: 'circle', date: '2020-12-22' },
  { date: '2021-1-22' },
]
  1. 单个日期不传markType 默认取传入的Marktype
  2. 单个日期不传color 默认是#f00
1.0.6

3 years ago

1.0.5

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago