chore: correct return type of getSelectedTime (#12768)

This commit is contained in:
neverland 2024-04-04 15:23:38 +08:00 committed by GitHub
parent 6713778618
commit a830c230af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 28 deletions

View File

@ -18,9 +18,11 @@ import {
formatValueRange,
} from './utils';
// Composables
import { useExpose } from '../composables/use-expose';
// Components
import { Picker, PickerInstance } from '../picker';
import { useExpose } from '../composables/use-expose';
const currentYear = new Date().getFullYear();
const [name] = createNamespace('date-picker');
@ -134,13 +136,9 @@ export default defineComponent({
return genOptions(minDate, maxDate, 'day', props.formatter, props.filter);
};
const confirm = () => {
return pickerRef.value?.confirm();
};
const confirm = () => pickerRef.value?.confirm();
const getSelectedDate = () => {
return currentValues.value;
};
const getSelectedDate = () => currentValues.value;
const columns = computed(() =>
props.columnsType.map((type) => {

View File

@ -211,7 +211,7 @@ Use [ref](https://vuejs.org/guide/essentials/template-refs.html) to get Picker i
| Name | Description | Attribute | Return value |
| --- | --- | --- | --- |
| confirm | Stop scrolling and emit confirm event | - | - |
| getSelectedDate | Get current selected date | - | _string[] \| undefined_ |
| getSelectedDate | Get current selected date | - | _string[]_ |
### Types

View File

@ -214,10 +214,10 @@ export default {
通过 ref 可以获取到 Picker 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
| 方法名 | 说明 | 参数 | 返回值 |
| --- | --- | --- | --- |
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
| getSelectedDate | 获取当前选中的日期 | - | _string[] \| undefined_ |
| 方法名 | 说明 | 参数 | 返回值 |
| --------------- | --------------------------------- | ---- | ---------- |
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
| getSelectedDate | 获取当前选中的日期 | - | _string[]_ |
### 类型定义

View File

@ -290,7 +290,7 @@ Use [ref](https://vuejs.org/guide/essentials/template-refs.html) to get Picker i
| Name | Description | Attribute | Return value |
| --- | --- | --- | --- |
| confirm | Stop scrolling and emit confirm event | - | - |
| getSelectedTime | Get current selected time | - | _string[] \| undefined_ |
| getSelectedTime | Get current selected time | - | _string[]_ |
### Types

View File

@ -288,10 +288,10 @@ export default {
通过 ref 可以获取到 Picker 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
| 方法名 | 说明 | 参数 | 返回值 |
| --- | --- | --- | --- |
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
| getSelectedTime | 获取当前选中的时间 | - | _string[] \| undefined_ |
| 方法名 | 说明 | 参数 | 返回值 |
| --------------- | --------------------------------- | ---- | ---------- |
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
| getSelectedTime | 获取当前选中的时间 | - | _string[]_ |
### 类型定义

View File

@ -17,19 +17,19 @@ import {
type TimeFilter,
} from '../date-picker/utils';
import {
createNamespace,
pick,
extend,
isSameValue,
makeNumericProp,
pick,
createNamespace,
} from '../utils';
// Components
import { Picker, PickerInstance } from '../picker';
// Composables
import { useExpose } from '../composables/use-expose';
// Components
import { Picker, PickerInstance } from '../picker';
const [name] = createNamespace('time-picker');
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
@ -90,13 +90,9 @@ export default defineComponent({
);
};
const confirm = () => {
return pickerRef.value?.confirm();
};
const confirm = () => pickerRef.value?.confirm();
const getSelectedTime = (): string[] => {
return currentValues.value;
};
const getSelectedTime = () => currentValues.value;
const columns = computed(() => {
let { minHour, maxHour, minMinute, maxMinute, minSecond, maxSecond } =