[React] 基于react 拖拽时间选择器


上图:

基于react-selectable-fast开发的一个鼠标拖拽时间段选择器。

github地址:https://github.com/ozx174/time-period-selector.git

示例demo:
git clone https://github.com/ozx174/time-period-selector.git

yarn install or npm install
yarn start or npm start

 

使用方法:

yarn add @congbao/time-period-selector 或者 npm install @congbao/time-period-selector

import TimePeriodSelector from '@congbao/time-period-selector'

import '@congbao/time-period-selector/lib/main.min.css'

<TimePeriodSelector defaultSelected={[1, 2, 3, 4] onSelectionFinish={(items) => { console.log(items) }} /}

#defaultSelected

传入数组为选中格子下标,从左到右,从上到下,从0开始。

#onSelectionFinish

传入选择后回调函数。参数是选中后的格子

items => []

item => {column: 0, row:0, index: 0}

index为格子下标,从左到右,从上到下

column代表时间点,从0开始

row代表星期几,从0开始

 

这个组件是预先开发的,后台还没定义好数据格式,所以还没做时间段数据转换的优化。后面继续更新。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM