chore: remove object spead (#8514)
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
import {
|
||||
pick,
|
||||
range,
|
||||
extend,
|
||||
isDate,
|
||||
padZero,
|
||||
createNamespace,
|
||||
@@ -39,8 +40,7 @@ const [name] = createNamespace('date-picker');
|
||||
export default defineComponent({
|
||||
name,
|
||||
|
||||
props: {
|
||||
...sharedProps,
|
||||
props: extend({}, sharedProps, {
|
||||
modelValue: Date,
|
||||
type: {
|
||||
type: String as PropType<DatetimePickerType>,
|
||||
@@ -56,7 +56,7 @@ export default defineComponent({
|
||||
default: () => new Date(currentYear + 10, 11, 31),
|
||||
validator: isDate,
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
emits: ['confirm', 'cancel', 'change', 'update:modelValue'],
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ref, defineComponent } from 'vue';
|
||||
import { pick, createNamespace, ComponentInstance } from '../utils';
|
||||
import { pick, createNamespace, ComponentInstance, extend } from '../utils';
|
||||
import { useExpose } from '../composables/use-expose';
|
||||
import TimePicker from './TimePicker';
|
||||
import DatePicker from './DatePicker';
|
||||
@@ -12,11 +12,9 @@ const datePickerProps = Object.keys(DatePicker.props);
|
||||
export default defineComponent({
|
||||
name,
|
||||
|
||||
props: {
|
||||
...TimePicker.props,
|
||||
...DatePicker.props,
|
||||
props: extend({}, TimePicker.props, DatePicker.props, {
|
||||
modelValue: [String, Date],
|
||||
},
|
||||
}),
|
||||
|
||||
setup(props, { attrs, slots }) {
|
||||
const root = ref<ComponentInstance>();
|
||||
@@ -38,7 +36,8 @@ export default defineComponent({
|
||||
v-slots={slots}
|
||||
ref={root}
|
||||
class={bem()}
|
||||
{...{ ...inheritProps, ...attrs }}
|
||||
{...inheritProps}
|
||||
{...attrs}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import {
|
||||
pick,
|
||||
range,
|
||||
extend,
|
||||
padZero,
|
||||
createNamespace,
|
||||
ComponentInstance,
|
||||
@@ -28,8 +29,7 @@ const [name] = createNamespace('time-picker');
|
||||
export default defineComponent({
|
||||
name,
|
||||
|
||||
props: {
|
||||
...sharedProps,
|
||||
props: extend({}, sharedProps, {
|
||||
modelValue: String,
|
||||
minHour: {
|
||||
type: [Number, String],
|
||||
@@ -47,7 +47,7 @@ export default defineComponent({
|
||||
type: [Number, String],
|
||||
default: 59,
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
emits: ['confirm', 'cancel', 'change', 'update:modelValue'],
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { PropType } from 'vue';
|
||||
import { extend } from '../utils';
|
||||
import { pickerProps } from '../picker/Picker';
|
||||
|
||||
export type ColumnType = 'year' | 'month' | 'day' | 'hour' | 'minute';
|
||||
@@ -11,15 +12,14 @@ export type DatetimePickerType =
|
||||
| 'month-day'
|
||||
| 'year-month';
|
||||
|
||||
export const sharedProps = {
|
||||
...pickerProps,
|
||||
export const sharedProps = extend({}, pickerProps, {
|
||||
filter: Function as PropType<(type: string, values: string[]) => string[]>,
|
||||
columnsOrder: Array as PropType<ColumnType[]>,
|
||||
formatter: {
|
||||
type: Function as PropType<(type: string, value: string) => string>,
|
||||
default: (type: string, value: string) => value,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
export const pickerKeys = Object.keys(pickerProps) as Array<
|
||||
keyof typeof pickerProps
|
||||
|
||||
Reference in New Issue
Block a user