Skip to content

Commit c61b33f

Browse files
TAYUNMoonofweisheng
authored andcommitted
docs(datetime-picker): 添加 before-confirm 回调中使用loading的提示
在 DateTimePicker 组件的文档中添加了关于 before-confirm 回调函数的使用提示。说明了在调用 resolve 函数之前,需要确保 picker 参数的 loading 状态为 false,否则无法正确触发组件的 @confirm 事件。 - 在中文文档和英文文档中均添加了此提示信息
1 parent 5a458fc commit c61b33f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎docs/component/datetime-picker.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ const filter = (type, values) => {
197197

198198
设置 `before-confirm` 函数,在用户点击`确定`按钮时,会执行 `before-confirm` 函数,并传入 `value`(time 类型为字符串,其他为时间戳,当picker为区间选择时,`value`为数组) 、 `resolve` 和 `picker` 参数,可以对 `value` 进行校验,并通过 `resolve` 函数告知组件是否确定通过,`resolve` 接受1个 boolean 值,`resolve(true)` 表示选项通过,`resolve(false)` 表示选项不通过,不通过时不会关闭 `picker`弹窗。可以通过 `picker` 参数直接设置 `loading` 等属性。
199199

200+
:::tip 提示
201+
在调用 `resolve` 之前须确保 `picker` 参数 `loading` 的加载状态为 `false` ,否则无法正确触发组件的 `@confirm` 事件。
202+
:::
203+
200204
```html
201205
<wd-toast></wd-toast>
202206
<wd-datetime-picker label="before-confirm" v-model="value" :before-confirm="beforeConfirm" @confirm="handleConfirm" />

‎docs/en-US/component/datetime-picker.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ Set the `align-right` property to display the picker's value aligned to the righ
197197

198198
Set the `before-confirm` function, which will be executed when the user clicks the 'confirm' button. It receives `value` (string for time type, timestamp for others, array when picker is in range selection mode), `resolve`, and `picker` parameters. You can validate the `value` and use the `resolve` function to tell the component whether to confirm. `resolve` accepts a boolean value, `resolve(true)` means the option is approved, `resolve(false)` means the option is not approved, and the picker popup won't close when not approved. You can directly set properties like `loading` through the `picker` parameter.
199199

200+
:::tip Note
201+
Before calling `resolve`, ensure that the `picker` parameter's `loading` state is set to `false`, otherwise the component's `@confirm` event cannot be triggered correctly.
202+
:::
203+
200204
```html
201205
<wd-toast></wd-toast>
202206
<wd-datetime-picker label="before-confirm" v-model="value" :before-confirm="beforeConfirm" @confirm="handleConfirm" />

0 commit comments

Comments
 (0)