Giter Site home page Giter Site logo

vdfor / react-h5-calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kokiy/react-h5-calendar

0.0 0.0 0.0 4 MB

react 移动端日历插件。上下滑动切换周/月模式。支持两种模式:1,月模式,左右滑动切换月份。2、周模式,左右滑动切换周. h5 日历组件, 支持日期标记

Home Page: https://www.npmjs.com/package/react-h5-calendar

JavaScript 84.76% Less 13.98% Shell 1.26%

react-h5-calendar's Introduction

react-h5-calendar

简体中文 | English

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

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

demo

demo

扫描二维码直接查看 demo

demo

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 展示类型支持monthweek month
transitionDuration 切换日期的动画过渡时间 0.3
onDateClick 日期点击回调 () => {}
onTouchStart 滑动开始回调 () => {}
onTouchMove 滑动过程中回调 () => {}
onTouchEnd 滑动结束回调 () => {}
markType 标记类型 支持dotcircle dot
markDates 需要标记的日期数组 []

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

react-h5-calendar's People

Contributors

kokiy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.