อัพเดทเวลา
This commit is contained in:
parent
6c1d146c69
commit
421f4d5805
1 changed files with 23 additions and 5 deletions
|
|
@ -160,12 +160,30 @@ const confirm = () => {
|
||||||
dialogTime.value = true;
|
dialogTime.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var date = Date.now();
|
// var date = Date.now();
|
||||||
let formattedH = moment(date).format("HH");
|
// let formattedH = moment(date).format("HH");
|
||||||
let formattedM = moment(date).format("mm");
|
// let formattedM = moment(date).format("mm");
|
||||||
let formattedS = moment(date).format("ss");
|
// let formattedS = moment(date).format("ss");
|
||||||
|
|
||||||
const time = new Date().toLocaleTimeString();
|
const time = new Date().toLocaleTimeString();
|
||||||
|
const formattedS = ref();
|
||||||
|
const formattedM = ref();
|
||||||
|
const formattedH = ref();
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
updateClock();
|
||||||
|
});
|
||||||
|
|
||||||
|
// อัพเดทเวลา
|
||||||
|
function updateClock() {
|
||||||
|
const date = Date.now();
|
||||||
|
let hh = moment(date).format("HH");
|
||||||
|
let mm = moment(date).format("mm");
|
||||||
|
let ss = moment(date).format("ss");
|
||||||
|
formattedS.value = ss;
|
||||||
|
formattedM.value = mm;
|
||||||
|
formattedH.value = hh;
|
||||||
|
}
|
||||||
|
setInterval(updateClock, 1000); // เรียกอัพเดททุกๆ 1 วิ
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue