鍍金池/ 問答/HTML/ antd 日期選擇組件

antd 日期選擇組件

react antd DatePicker日期選擇框
如何設置只能選擇指定月份的日期, 比如智能選擇2018年5月選擇日期。

回答
編輯回答
你的瞳

disabledDate

clipboard.png

disabledDateFun = (current) => {
    return true;    // 不能選擇的日期返回true,能選的返回false
};

<DatePicker
    disabledDate={this.disabledDateFun}
/>
2017年2月25日 08:52
編輯回答
脾氣硬

emmmm,沒明白啥意思。。。你是想說固定月份,然后讓用戶選擇日期?

2017年3月22日 20:14
編輯回答
遲月

”智能“, 你管這個叫智能嗎? 如果antd真是這么做就是bug了。

你只需要defaultValue ={moment(new Date())} 就好了

具體api: https://ant.design/components...

2017年8月23日 08:28