mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 15:13:21 +08:00
358ff50cc3
Co-authored-by: Anton <anton@scinote.net>
35 lines
1.1 KiB
Vue
35 lines
1.1 KiB
Vue
<template>
|
|
<div class="datepicker sci-input-container right-icon">
|
|
<input @change="update" type="datetime" class="form-control calendar-input sci-input-field" :id="this.selectorId" placeholder="" />
|
|
<i class="fas fa-calendar-alt"></i>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'DatePicker',
|
|
props: {
|
|
selectorId: { type: String, required: true },
|
|
useCurrent: { type: Boolean, default: true },
|
|
defaultValue: { type: Date, default: true }
|
|
},
|
|
mounted() {
|
|
$("#" + this.selectorId).datetimepicker(
|
|
{
|
|
useCurrent: this.useCurrent,
|
|
ignoreReadonly: this.ignoreReadOnly,
|
|
locale: this.i18n.locale,
|
|
format: this.dateFormat,
|
|
date: this.defaultValue
|
|
}
|
|
);
|
|
this.update($("#" + this.selectorId).data("DateTimePicker").date());
|
|
$("#" + this.selectorId).on('dp.change', (e) => this.update(e.date))
|
|
},
|
|
methods: {
|
|
update(value) {
|
|
this.$emit('change', (value._isAMomentObject) ? value.toDate() : '');
|
|
}
|
|
}
|
|
}
|
|
</script>
|