mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: migrate DatetimePicker component
This commit is contained in:
parent
472f266c2c
commit
bfe2e9843b
@ -51,4 +51,5 @@ module.exports = [
|
|||||||
'checkbox-group',
|
'checkbox-group',
|
||||||
'radio',
|
'radio',
|
||||||
'radio-group',
|
'radio-group',
|
||||||
|
'datetime-picker',
|
||||||
];
|
];
|
||||||
|
@ -36,6 +36,7 @@ Vant 遵循 [Semver](https://semver.org/lang/zh-CN/) 语义化版本规范。
|
|||||||
|
|
||||||
- Checkbox
|
- Checkbox
|
||||||
- CheckboxGroup
|
- CheckboxGroup
|
||||||
|
- DatetimePicker
|
||||||
- Field
|
- Field
|
||||||
- Radio
|
- Radio
|
||||||
- RadioGroup
|
- RadioGroup
|
||||||
|
@ -28,12 +28,14 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['confirm', 'cancel', 'change', 'update:modelValue'],
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
filter: 'updateInnerValue',
|
filter: 'updateInnerValue',
|
||||||
minDate: 'updateInnerValue',
|
minDate: 'updateInnerValue',
|
||||||
maxDate: 'updateInnerValue',
|
maxDate: 'updateInnerValue',
|
||||||
|
|
||||||
value(val) {
|
modelValue(val) {
|
||||||
val = this.formatValue(val);
|
val = this.formatValue(val);
|
||||||
|
|
||||||
if (val.valueOf() !== this.innerValue.valueOf()) {
|
if (val.valueOf() !== this.innerValue.valueOf()) {
|
||||||
|
@ -28,6 +28,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['confirm', 'cancel', 'change', 'update:modelValue'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
ranges() {
|
ranges() {
|
||||||
return [
|
return [
|
||||||
|
@ -19,16 +19,6 @@ export default createComponent({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const Component = this.type === 'time' ? TimePicker : DatePicker;
|
const Component = this.type === 'time' ? TimePicker : DatePicker;
|
||||||
|
return <Component ref="root" class={bem()} {...this.$props} />;
|
||||||
return (
|
|
||||||
<Component
|
|
||||||
ref="root"
|
|
||||||
class={bem()}
|
|
||||||
{...{
|
|
||||||
props: this.$props,
|
|
||||||
on: this.$listeners,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -5,8 +5,8 @@ import Picker from '../picker';
|
|||||||
|
|
||||||
export const sharedProps = {
|
export const sharedProps = {
|
||||||
...pickerProps,
|
...pickerProps,
|
||||||
value: null,
|
|
||||||
filter: Function,
|
filter: Function,
|
||||||
|
modelValue: null,
|
||||||
showToolbar: {
|
showToolbar: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
@ -21,7 +21,7 @@ export const sharedProps = {
|
|||||||
export const TimePickerMixin = {
|
export const TimePickerMixin = {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
innerValue: this.formatValue(this.value),
|
innerValue: this.formatValue(this.modelValue),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ export const TimePickerMixin = {
|
|||||||
columns: 'updateColumnValue',
|
columns: 'updateColumnValue',
|
||||||
|
|
||||||
innerValue(val) {
|
innerValue(val) {
|
||||||
this.$emit('input', val);
|
this.$emit('update:modelValue', val);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ export const TimePickerMixin = {
|
|||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onConfirm={this.onConfirm}
|
onConfirm={this.onConfirm}
|
||||||
onCancel={this.onCancel}
|
onCancel={this.onCancel}
|
||||||
{...{ props }}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -123,10 +123,10 @@ module.exports = {
|
|||||||
path: 'checkbox',
|
path: 'checkbox',
|
||||||
title: 'Checkbox 复选框',
|
title: 'Checkbox 复选框',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'datetime-picker',
|
path: 'datetime-picker',
|
||||||
// title: 'DatetimePicker 时间选择',
|
title: 'DatetimePicker 时间选择',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'field',
|
path: 'field',
|
||||||
title: 'Field 输入框',
|
title: 'Field 输入框',
|
||||||
@ -457,10 +457,10 @@ module.exports = {
|
|||||||
path: 'checkbox',
|
path: 'checkbox',
|
||||||
title: 'Checkbox',
|
title: 'Checkbox',
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// path: 'datetime-picker',
|
path: 'datetime-picker',
|
||||||
// title: 'DatetimePicker',
|
title: 'DatetimePicker',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
path: 'field',
|
path: 'field',
|
||||||
title: 'Field',
|
title: 'Field',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user