Skip to content
Snippets Groups Projects
Commit 438556b9 authored by JunGu Kang's avatar JunGu Kang
Browse files

#23 Add Datetime Field Component and moment Dependency

parent 3a6be635
Branches #23
No related tags found
2 merge requests!37Deploy,!23#23 Add Datetime Field Component and moment Dependency
Pipeline #4321 passed
...@@ -8810,6 +8810,11 @@ ...@@ -8810,6 +8810,11 @@
} }
} }
}, },
"moment": {
"version": "2.24.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
},
"move-concurrently": { "move-concurrently": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"core-js": "^3.3.2", "core-js": "^3.3.2",
"moment": "^2.24.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuetify": "^2.1.0", "vuetify": "^2.1.0",
......
<template>
<v-row>
<v-col
cols="6"
>
<v-menu
:close-on-content-click="false"
min-width="290px"
offset-y
v-model="showDatePicker"
>
<template
v-slot:activator="{ on }"
>
<v-text-field
label="날짜"
readonly
v-model="date"
v-on="on"
></v-text-field>
</template>
<v-date-picker
v-model="date"
@input="showDatePicker = false"
></v-date-picker>
</v-menu>
</v-col>
<v-col
col="6"
>
<v-menu
:close-on-content-click="false"
min-width="290px"
offset-y
v-model="showTimePicker"
>
<template
v-slot:activator="{ on }"
>
<v-text-field
label="시각"
readonly
v-model="time"
v-on="on"
></v-text-field>
</template>
<v-time-picker
v-model="time"
@input="showTimePicker = false"
></v-time-picker>
</v-menu>
</v-col>
</v-row>
</template>
<script>
import moment from 'moment';
export default {
name: 'DateTimeField',
props: ['datetime'],
data: () => ({
showDatePicker: false,
showTimePicker: false,
date: '',
time: '',
}),
watch: {
date() {
this.$emit('update:datetime', `${this.date} ${this.time}`);
},
time() {
this.$emit('update:datetime', `${this.date} ${this.time}`);
},
},
created() {
const m = moment(this.datetime);
this.date = m.format('YYYY-MM-DD');
this.time = m.format('HH:mm');
},
};
</script>
<style scoped>
.col {
padding: 0 12px 0;
}
</style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment