feat: migrate DatetimePicker component

This commit is contained in:
chenjiahan
2020-08-15 07:37:41 +08:00
parent 472f266c2c
commit bfe2e9843b
7 changed files with 20 additions and 24 deletions
+3 -1
View File
@@ -28,12 +28,14 @@ export default createComponent({
},
},
emits: ['confirm', 'cancel', 'change', 'update:modelValue'],
watch: {
filter: 'updateInnerValue',
minDate: 'updateInnerValue',
maxDate: 'updateInnerValue',
value(val) {
modelValue(val) {
val = this.formatValue(val);
if (val.valueOf() !== this.innerValue.valueOf()) {
+2
View File
@@ -28,6 +28,8 @@ export default createComponent({
},
},
emits: ['confirm', 'cancel', 'change', 'update:modelValue'],
computed: {
ranges() {
return [
+1 -11
View File
@@ -19,16 +19,6 @@ export default createComponent({
render() {
const Component = this.type === 'time' ? TimePicker : DatePicker;
return (
<Component
ref="root"
class={bem()}
{...{
props: this.$props,
on: this.$listeners,
}}
/>
);
return <Component ref="root" class={bem()} {...this.$props} />;
},
});
+4 -4
View File
@@ -5,8 +5,8 @@ import Picker from '../picker';
export const sharedProps = {
...pickerProps,
value: null,
filter: Function,
modelValue: null,
showToolbar: {
type: Boolean,
default: true,
@@ -21,7 +21,7 @@ export const sharedProps = {
export const TimePickerMixin = {
data() {
return {
innerValue: this.formatValue(this.value),
innerValue: this.formatValue(this.modelValue),
};
},
@@ -57,7 +57,7 @@ export const TimePickerMixin = {
columns: 'updateColumnValue',
innerValue(val) {
this.$emit('input', val);
this.$emit('update:modelValue', val);
},
},
@@ -97,7 +97,7 @@ export const TimePickerMixin = {
onChange={this.onChange}
onConfirm={this.onConfirm}
onCancel={this.onCancel}
{...{ props }}
{...props}
/>
);
},