鍍金池/ 問答/HTML/ AntDesign3.x DatePicker組件如何使用

AntDesign3.x DatePicker組件如何使用

render:

<FormItem {...formItemLayout} label="上市時(shí)間:">
    {fieldProps.listing_time(
        <DatePicker style={{ width: "100%" }} format={'YYYY-MM-DD'}/>
    )}
</FormItem>

統(tǒng)一設(shè)置字段屬性:

  _getFieldProps() {
    ...
     return {
     ...
        //上市時(shí)間
        listing_time: getFieldDecorator("listing_time", {
            initialValue: moment(product.listing_time),
            rules: [
                { required: true, message: "請(qǐng)選擇上市時(shí)間", type: "date" }
            ]
        }),
     }
}

問題:點(diǎn)擊其他日期時(shí)報(bào)錯(cuò):
圖片描述

回答
編輯回答
冷溫柔

rules中的type刪掉

2018年3月8日 22:49