Skip to content

a-range-picker 组件使用 v-decorator 绑定的问题 #1589

@wangkaiChen1118

Description

@wangkaiChen1118
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.4.10

Environment

vue 2.6.10

Steps to reproduce

使用 a-range-picker 时,用 v-decorator 绑定 ,
给这个事件选择组件设置默认值 v-decorator="['time', { initialValue: [null, null] } ]"

<a-range-picker
:showTime="{ format: 'YYYY-MM-DD HH:mm:ss' }"
format="YYYY-MM-DD HH:mm:ss"
:placeholder="['Start Time', 'End Time']"
@change="handleTimeChange"
@ok="onOk"
v-decorator="['time', { initialValue: [null, null] } ]"
/>

然后因为这个 有效时间非必选,所以点击详情回显时,这个组件需要使用 this.form.setFieldsValue( { time: [ null , null] } ) 重置为空,
问题在于,重置为空是有效的,但是控制台会报错 ----- >

vue.runtime.esm.js:620 [Vue warn]: Invalid prop: custom validator check failed for prop "value".

found in

--->

并且此处控制台会有如下警告
[VueTypes warn]: isMomentArray - custom validation failed

这个是不是因为,该组件没有对这个 [ null, null ] 做处理,
或者怎样设置改组件的值为空呢??

What is expected?

期望 a-range-picker 结合 v-decorator 使用时 , 用 this.form.setFieldsValue( { time: [ null , null] } ) 重置为空控制台不报错

What is actually happening?

a-range-picker 结合 v-decorator 使用时 , 用 this.form.setFieldsValue( { time: [ null , null] } ) 重置为空控制台会报错
------->
vue.runtime.esm.js:620 [Vue warn]: Invalid prop: custom validator check failed for prop "value".

found in

--->

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions