An open API service indexing awesome lists of open source software.

https://github.com/future-team/rc-calender-show

A component like iphone calender events show.
https://github.com/future-team/rc-calender-show

Last synced: 16 days ago
JSON representation

A component like iphone calender events show.

Awesome Lists containing this project

README

          

# Calender events show
A component like iphone calender events show.

## Usage

Install
```bash
$ npm install rc-calender-show --save
```

Use in react
```javascript
import React, {Component, PropTypes} from 'react'
import ReactDom from 'react/lib/ReactDOM'
import CalenderShow from 'rc-calender-show'
class Demo extends Component {
static propTypes = {
date: PropTypes.object
};
static defaultProps={
date: new Date()
};
constructor(props, context) {
super(props, context)
this.state = {
defaultDate: null,
date: null
}
}
componentWillMount() {}
componentDidMount() {}
componentWillReceiveProps() {}
shouldComponentUpdate() {return true}
dateChanged(date) {
this.setState({
date: date
})
}
weekChanged(weekRange) {
this.setMark(weekRange)
}
renderList() {
const date = this.state.date
return date ? (

这个列表渲染呢的时间为{date.getFullYear()} - {date.getMonth()+1} - {date.getDate()}

) : (

出错啦!

)
}
setMark() {
const mark = [
{
date: '2016-11-20',
count: 1
},
{
date: '2016-11-23',
count: 100
},
{
date: '2016-11-26',
count: 10
},
{
date: '2016-11-21',
count: 0
},
{
date: '2016-11-22',
count: 0
}
]
this.setState({
mark: mark
})
}
render() {
return (

设置红点


{ this.state.date &&

你选择的日期是:{this.state.date.getFullYear()},{this.state.date.getMonth()+1},{this.state.date.getDate()}

}
{this.dateChanged(date)}} defaultDate={this.state.defaultDate} setMark={this.state.mark} weekChanged={::this.weekChanged}>
{
this.renderList()
}


)
}
}

ReactDom.render(

, document.getElementById('root')
)
```

the detail please checkout repo and run demo.
```bash
$ git clone https://github.com/future-team/rc-calender-show.git && cd rc-calender-show && npm install && npm run demo
```

## Contribute
Welcome create issue or pull request,:)