mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 03:22:08 +08:00 
			
		
		
		
	fix(TimePicker): remove columns-order prop
This commit is contained in:
		
							parent
							
								
									42d1dd836c
								
							
						
					
					
						commit
						7d22cc2155
					
				| @ -5,6 +5,7 @@ import { | |||||||
|   nextTick, |   nextTick, | ||||||
|   onMounted, |   onMounted, | ||||||
|   defineComponent, |   defineComponent, | ||||||
|  |   type PropType, | ||||||
| } from 'vue'; | } from 'vue'; | ||||||
| 
 | 
 | ||||||
| // Utils
 | // Utils
 | ||||||
| @ -44,6 +45,7 @@ export default defineComponent({ | |||||||
|   props: extend({}, sharedProps, { |   props: extend({}, sharedProps, { | ||||||
|     type: makeStringProp<DatetimePickerType>('datetime'), |     type: makeStringProp<DatetimePickerType>('datetime'), | ||||||
|     modelValue: Date, |     modelValue: Date, | ||||||
|  |     columnsOrder: Array as PropType<DatetimePickerColumnType[]>, | ||||||
|     minDate: { |     minDate: { | ||||||
|       type: Date, |       type: Date, | ||||||
|       default: () => new Date(currentYear - 10, 0, 1), |       default: () => new Date(currentYear - 10, 0, 1), | ||||||
|  | |||||||
| @ -2,13 +2,11 @@ import { extend } from '../utils'; | |||||||
| import { pickerSharedProps } from '../picker/Picker'; | import { pickerSharedProps } from '../picker/Picker'; | ||||||
| import type { PropType } from 'vue'; | import type { PropType } from 'vue'; | ||||||
| import type { PickerInstance, PickerOption } from '../picker'; | import type { PickerInstance, PickerOption } from '../picker'; | ||||||
| import type { DatetimePickerColumnType } from './types'; |  | ||||||
| 
 | 
 | ||||||
| export const sharedProps = extend({}, pickerSharedProps, { | export const sharedProps = extend({}, pickerSharedProps, { | ||||||
|   filter: Function as PropType< |   filter: Function as PropType< | ||||||
|     (columnType: string, options: PickerOption[]) => PickerOption[] |     (columnType: string, options: PickerOption[]) => PickerOption[] | ||||||
|   >, |   >, | ||||||
|   columnsOrder: Array as PropType<DatetimePickerColumnType[]>, |  | ||||||
|   formatter: { |   formatter: { | ||||||
|     type: Function as PropType< |     type: Function as PropType< | ||||||
|       (type: string, option: PickerOption) => PickerOption |       (type: string, option: PickerOption) => PickerOption | ||||||
|  | |||||||
| @ -140,7 +140,6 @@ export default { | |||||||
| | readonly | Whether to be readonly | _boolean_ | `false` | | | readonly | Whether to be readonly | _boolean_ | `false` | | ||||||
| | filter | Option filter | _(type: string, options: PickerOption[]) => PickerOption[]_ | - | | | filter | Option filter | _(type: string, options: PickerOption[]) => PickerOption[]_ | - | | ||||||
| | formatter | Option text formatter | _(type: string, option: PickerOption) => PickerOption_ | - | | | formatter | Option text formatter | _(type: string, option: PickerOption) => PickerOption_ | - | | ||||||
| | columns-order | Array for ordering columns, where item can be set to<br> `hour`、`minute` | _string[]_ | - | |  | ||||||
| | option-height | Option height, supports `px` `vw` `vh` `rem` unit, default `px` | _number \| string_ | `44` | | | option-height | Option height, supports `px` `vw` `vh` `rem` unit, default `px` | _number \| string_ | `44` | | ||||||
| | visible-option-num | Count of visible columns | _number \| string_ | `6` | | | visible-option-num | Count of visible columns | _number \| string_ | `6` | | ||||||
| | swipe-duration | Duration of the momentum animation,unit `ms` | _number \| string_ | `1000` | | | swipe-duration | Duration of the momentum animation,unit `ms` | _number \| string_ | `1000` | | ||||||
|  | |||||||
| @ -139,7 +139,6 @@ export default { | |||||||
| | readonly | 是否为只读状态,只读状态下无法切换选项 | _boolean_ | `false` | | | readonly | 是否为只读状态,只读状态下无法切换选项 | _boolean_ | `false` | | ||||||
| | filter | 选项过滤函数 | _(type: string, options: PickerOption[]) => PickerOption[]_ | - | | | filter | 选项过滤函数 | _(type: string, options: PickerOption[]) => PickerOption[]_ | - | | ||||||
| | formatter | 选项格式化函数 | _(type: string, option: PickerOption) => PickerOption_ | - | | | formatter | 选项格式化函数 | _(type: string, option: PickerOption) => PickerOption_ | - | | ||||||
| | columns-order | 自定义列排序数组, 子项可选值为<br> `hour`、`minute` | _string[]_ | - | |  | ||||||
| | option-height | 选项高度,支持 `px` `vw` `vh` `rem` 单位,默认 `px` | _number \| string_ | `44` | | | option-height | 选项高度,支持 `px` `vw` `vh` `rem` 单位,默认 `px` | _number \| string_ | `44` | | ||||||
| | visible-option-num | 可见的选项个数 | _number \| string_ | `6` | | | visible-option-num | 可见的选项个数 | _number \| string_ | `6` | | ||||||
| | swipe-duration | 快速滑动时惯性滚动的时长,单位 `ms` | _number \| string_ | `1000` | | | swipe-duration | 快速滑动时惯性滚动的时长,单位 `ms` | _number \| string_ | `1000` | | ||||||
|  | |||||||
| @ -62,11 +62,11 @@ export default defineComponent({ | |||||||
| 
 | 
 | ||||||
|     const ranges = computed(() => [ |     const ranges = computed(() => [ | ||||||
|       { |       { | ||||||
|         type: 'hour', |         type: 'hour' as const, | ||||||
|         range: [+props.minHour, +props.maxHour], |         range: [+props.minHour, +props.maxHour], | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         type: 'minute', |         type: 'minute' as const, | ||||||
|         range: [+props.minMinute, +props.maxMinute], |         range: [+props.minMinute, +props.maxMinute], | ||||||
|       }, |       }, | ||||||
|     ]); |     ]); | ||||||
|  | |||||||
| @ -48,7 +48,11 @@ const formatter = (type: string, option: PickerOption) => { | |||||||
| 
 | 
 | ||||||
| <template> | <template> | ||||||
|   <demo-block card :title="t('basicUsage')"> |   <demo-block card :title="t('basicUsage')"> | ||||||
|     <van-time-picker v-model="baseTime" :title="t('chooseTime')" /> |     <van-time-picker | ||||||
|  |       v-model="baseTime" | ||||||
|  |       :title="t('chooseTime')" | ||||||
|  |       :columns-order="['minute', 'hour']" | ||||||
|  |     /> | ||||||
|   </demo-block> |   </demo-block> | ||||||
| 
 | 
 | ||||||
|   <demo-block card :title="t('timeRange')"> |   <demo-block card :title="t('timeRange')"> | ||||||
|  | |||||||
| @ -218,7 +218,7 @@ export default { | |||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 path: 'time-picker', |                 path: 'time-picker', | ||||||
|                 title: 'timePicker 时间选择', |                 title: 'TimePicker 时间选择', | ||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 path: 'uploader', |                 path: 'uploader', | ||||||
| @ -628,7 +628,7 @@ export default { | |||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 path: 'time-picker', |                 path: 'time-picker', | ||||||
|                 title: 'timePicker', |                 title: 'TimePicker', | ||||||
|               }, |               }, | ||||||
|               { |               { | ||||||
|                 path: 'uploader', |                 path: 'uploader', | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user