fix: Issues #218 done.
This commit is contained in:
@@ -58,6 +58,13 @@ export default {
|
||||
return value >= 0;
|
||||
},
|
||||
},
|
||||
updateMin: {
|
||||
type: Number,
|
||||
required: false,
|
||||
validator(value) {
|
||||
return value >= 0;
|
||||
},
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: false,
|
||||
@@ -133,6 +140,12 @@ export default {
|
||||
this.calculateTotalSeconds();
|
||||
},
|
||||
},
|
||||
updateMin: {
|
||||
handler: function(newValue, oldValue) {
|
||||
this.minTotal = newValue;
|
||||
this.calculateTotalSeconds();
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onClose () {
|
||||
@@ -235,12 +248,17 @@ export default {
|
||||
// 箭頭向上,數字加一
|
||||
newVal += this.tUnits[tUnit].inc;
|
||||
if(newVal > this.tUnits[tUnit].max) {
|
||||
// 超過該單位最大值時要進位為零
|
||||
newVal = newVal % (this.tUnits[tUnit].max + 1);
|
||||
// 前一個更大的單位要進位
|
||||
if(input.dataset.index > 0) {
|
||||
const prevUnit = document.querySelector(`input[data-index="${parseInt(input.dataset.index) - 1}"]`);
|
||||
this.actionUpDown(prevUnit, true);
|
||||
if(this.tUnits[tUnit].dsp === 'd'){
|
||||
// 超過 maxDays 要等於最大值
|
||||
this.totalSeconds = this.maxTotal;
|
||||
} else {
|
||||
// 超過該單位最大值時要進位為零
|
||||
newVal = newVal % (this.tUnits[tUnit].max + 1);
|
||||
// 前一個更大的單位要進位
|
||||
if(input.dataset.index > 0) {
|
||||
const prevUnit = document.querySelector(`input[data-index="${parseInt(input.dataset.index) - 1}"]`);
|
||||
this.actionUpDown(prevUnit, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -309,6 +327,9 @@ export default {
|
||||
totalSeconds = this.minTotal;
|
||||
this.secondToDate(this.minTotal, 'min');
|
||||
this.totalSeconds = totalSeconds;
|
||||
} else if((this.size === 'min' && totalSeconds <= this.maxTotal)) {
|
||||
this.maxDays = Math.floor(this.maxTotal / (3600 * 24));
|
||||
this.totalSeconds = totalSeconds;
|
||||
} else {
|
||||
this.totalSeconds = totalSeconds;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user