m-calendar
m-calendar copied to clipboard
type为range ,defatultValue值在初始化就传入的时候,没有选中
如题
It seems like this is caused because the constructor calls this.selectDate, but when the visibility changes it calls this.shortcutSelect, which sets the values correctly. Is there a reason that this.shortcutSelect is not called in the constructor?
I hacked a fix by wrapping the mobile calendar like below
import React from "react";
import {Calendar} from 'antd-mobile';
export default class MobileCalendar extends React.Component {
constructor(props) {
super(props);
this.state = {
visible: false,
};
}
componentDidMount(){
this.setState({
visible: true
})
}
render() {
const { ...props } = this.props;
return (
<Calendar {...props} visible={this.state.visible}/>
);
}
}