Issue #79: Done.

This commit is contained in:
chiayin
2023-09-21 17:52:06 +08:00
parent c73ef5d4ba
commit 013a459fed

View File

@@ -1,10 +1,15 @@
<template> <template>
<div class=" relative"> <div class=" relative">
<div class="flex justify-center items-center gap-1 px-1 w-32 border border-neutral-500 cursor-pointer" @click="openTimeSelect = !openTimeSelect"> <div class="w-32 px-1 border border-neutral-500 cursor-pointer" @click="openTimeSelect = !openTimeSelect">
<p>{{ days }}d</p> <div v-if="totalSeconds === 0" class="text-center">
<p>{{ hours }}h</p> <p>0s</p>
<p>{{ minutes }}m</p> </div>
<p>{{ seconds }}s</p> <div v-else class="flex justify-center items-center gap-1">
<p>{{ days }}d</p>
<p>{{ hours }}h</p>
<p>{{ minutes }}m</p>
<p>{{ seconds }}s</p>
</div>
</div> </div>
<div class="duration-container absolute left-0 top-full translate-y-2" v-show="openTimeSelect"> <div class="duration-container absolute left-0 top-full translate-y-2" v-show="openTimeSelect">
<div class="duration-box" v-for="(unit, index) in inputTypes" :key="unit"> <div class="duration-box" v-for="(unit, index) in inputTypes" :key="unit">
@@ -285,9 +290,11 @@ export default {
if(totalSeconds >= this.maxTotal){ // 大於最大值時要等於最大值 if(totalSeconds >= this.maxTotal){ // 大於最大值時要等於最大值
totalSeconds = this.maxTotal; totalSeconds = this.maxTotal;
this.secondToDate(this.maxTotal, 'max'); this.secondToDate(this.maxTotal, 'max');
this.totalSeconds = totalSeconds;
} else if (totalSeconds <= this.minTotal) { // 小於最小值時要等於最小值 } else if (totalSeconds <= this.minTotal) { // 小於最小值時要等於最小值
totalSeconds = this.minTotal; totalSeconds = this.minTotal;
this.secondToDate(this.minTotal, 'min'); this.secondToDate(this.minTotal, 'min');
this.totalSeconds = totalSeconds;
} else { } else {
this.totalSeconds = totalSeconds; this.totalSeconds = totalSeconds;
}; };