DateTimePicker: limit timepicker (#6076)

* fix: #5045

* fix: #5045
pull/6576/head
Dreamacro 2017-08-13 12:00:33 +08:00 committed by 杨奕
parent a5e5be3d7a
commit a1324324a2
2 changed files with 9 additions and 2 deletions

View File

@ -265,6 +265,11 @@
oldDate.setHours(hour);
oldDate.setMinutes(minute);
oldDate.setSeconds(second);
if (typeof this.disabledDate === 'function' && this.disabledDate(oldDate)) {
this.$refs.timepicker.disabled = true;
return;
}
this.$refs.timepicker.disabled = false;
this.date = new Date(oldDate.getTime());
}

View File

@ -23,7 +23,8 @@
@click="handleCancel">{{ t('el.datepicker.cancel') }}</button>
<button
type="button"
class="el-time-panel__btn confirm"
class="el-time-panel__btn"
:class="{confirm: !disabled}"
@click="handleConfirm()">{{ t('el.datepicker.confirm') }}</button>
</div>
</div>
@ -101,7 +102,8 @@
currentDate: this.$options.defaultValue || this.date || new Date(),
currentVisible: this.visible || false,
width: this.pickerWidth || 0,
selectionRange: [0, 2]
selectionRange: [0, 2],
disabled: false
};
},