mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: correct return type of getSelectedTime (#12768)
This commit is contained in:
parent
6713778618
commit
a830c230af
@ -18,9 +18,11 @@ import {
|
|||||||
formatValueRange,
|
formatValueRange,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
|
// Composables
|
||||||
|
import { useExpose } from '../composables/use-expose';
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { Picker, PickerInstance } from '../picker';
|
import { Picker, PickerInstance } from '../picker';
|
||||||
import { useExpose } from '../composables/use-expose';
|
|
||||||
|
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
const [name] = createNamespace('date-picker');
|
const [name] = createNamespace('date-picker');
|
||||||
@ -134,13 +136,9 @@ export default defineComponent({
|
|||||||
return genOptions(minDate, maxDate, 'day', props.formatter, props.filter);
|
return genOptions(minDate, maxDate, 'day', props.formatter, props.filter);
|
||||||
};
|
};
|
||||||
|
|
||||||
const confirm = () => {
|
const confirm = () => pickerRef.value?.confirm();
|
||||||
return pickerRef.value?.confirm();
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSelectedDate = () => {
|
const getSelectedDate = () => currentValues.value;
|
||||||
return currentValues.value;
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() =>
|
const columns = computed(() =>
|
||||||
props.columnsType.map((type) => {
|
props.columnsType.map((type) => {
|
||||||
|
@ -211,7 +211,7 @@ Use [ref](https://vuejs.org/guide/essentials/template-refs.html) to get Picker i
|
|||||||
| Name | Description | Attribute | Return value |
|
| Name | Description | Attribute | Return value |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| confirm | Stop scrolling and emit confirm event | - | - |
|
| confirm | Stop scrolling and emit confirm event | - | - |
|
||||||
| getSelectedDate | Get current selected date | - | _string[] \| undefined_ |
|
| getSelectedDate | Get current selected date | - | _string[]_ |
|
||||||
|
|
||||||
### Types
|
### Types
|
||||||
|
|
||||||
|
@ -215,9 +215,9 @@ export default {
|
|||||||
通过 ref 可以获取到 Picker 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
|
通过 ref 可以获取到 Picker 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
|
||||||
|
|
||||||
| 方法名 | 说明 | 参数 | 返回值 |
|
| 方法名 | 说明 | 参数 | 返回值 |
|
||||||
| --- | --- | --- | --- |
|
| --------------- | --------------------------------- | ---- | ---------- |
|
||||||
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
|
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
|
||||||
| getSelectedDate | 获取当前选中的日期 | - | _string[] \| undefined_ |
|
| getSelectedDate | 获取当前选中的日期 | - | _string[]_ |
|
||||||
|
|
||||||
### 类型定义
|
### 类型定义
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ Use [ref](https://vuejs.org/guide/essentials/template-refs.html) to get Picker i
|
|||||||
| Name | Description | Attribute | Return value |
|
| Name | Description | Attribute | Return value |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| confirm | Stop scrolling and emit confirm event | - | - |
|
| confirm | Stop scrolling and emit confirm event | - | - |
|
||||||
| getSelectedTime | Get current selected time | - | _string[] \| undefined_ |
|
| getSelectedTime | Get current selected time | - | _string[]_ |
|
||||||
|
|
||||||
### Types
|
### Types
|
||||||
|
|
||||||
|
@ -289,9 +289,9 @@ export default {
|
|||||||
通过 ref 可以获取到 Picker 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
|
通过 ref 可以获取到 Picker 实例并调用实例方法,详见[组件实例方法](#/zh-CN/advanced-usage#zu-jian-shi-li-fang-fa)。
|
||||||
|
|
||||||
| 方法名 | 说明 | 参数 | 返回值 |
|
| 方法名 | 说明 | 参数 | 返回值 |
|
||||||
| --- | --- | --- | --- |
|
| --------------- | --------------------------------- | ---- | ---------- |
|
||||||
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
|
| confirm | 停止惯性滚动并触发 `confirm` 事件 | - | - |
|
||||||
| getSelectedTime | 获取当前选中的时间 | - | _string[] \| undefined_ |
|
| getSelectedTime | 获取当前选中的时间 | - | _string[]_ |
|
||||||
|
|
||||||
### 类型定义
|
### 类型定义
|
||||||
|
|
||||||
|
@ -17,19 +17,19 @@ import {
|
|||||||
type TimeFilter,
|
type TimeFilter,
|
||||||
} from '../date-picker/utils';
|
} from '../date-picker/utils';
|
||||||
import {
|
import {
|
||||||
createNamespace,
|
pick,
|
||||||
extend,
|
extend,
|
||||||
isSameValue,
|
isSameValue,
|
||||||
makeNumericProp,
|
makeNumericProp,
|
||||||
pick,
|
createNamespace,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
|
|
||||||
// Components
|
|
||||||
import { Picker, PickerInstance } from '../picker';
|
|
||||||
|
|
||||||
// Composables
|
// Composables
|
||||||
import { useExpose } from '../composables/use-expose';
|
import { useExpose } from '../composables/use-expose';
|
||||||
|
|
||||||
|
// Components
|
||||||
|
import { Picker, PickerInstance } from '../picker';
|
||||||
|
|
||||||
const [name] = createNamespace('time-picker');
|
const [name] = createNamespace('time-picker');
|
||||||
|
|
||||||
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
export type TimePickerColumnType = 'hour' | 'minute' | 'second';
|
||||||
@ -90,13 +90,9 @@ export default defineComponent({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const confirm = () => {
|
const confirm = () => pickerRef.value?.confirm();
|
||||||
return pickerRef.value?.confirm();
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSelectedTime = (): string[] => {
|
const getSelectedTime = () => currentValues.value;
|
||||||
return currentValues.value;
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = computed(() => {
|
const columns = computed(() => {
|
||||||
let { minHour, maxHour, minMinute, maxMinute, minSecond, maxSecond } =
|
let { minHour, maxHour, minMinute, maxMinute, minSecond, maxSecond } =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user