fix: add default value for auto refresh interval #116

This commit is contained in:
Lykin 2024-01-11 21:34:12 +08:00
parent aab2531d40
commit 1a6756905d
2 changed files with 6 additions and 1 deletions

View File

@ -9,7 +9,7 @@ const props = defineProps({
tTooltip: String, tTooltip: String,
tooltipDelay: { tooltipDelay: {
type: Number, type: Number,
default: 1000, default: 800,
}, },
type: String, type: String,
icon: [String, Object], icon: [String, Object],

View File

@ -74,6 +74,10 @@ const startAutoRefresh = async () => {
return return
} }
autoRefresh.on = true autoRefresh.on = true
if (!isNaN(autoRefresh.interval)) {
autoRefresh.interval = 2
}
autoRefresh.interval = Math.min(autoRefresh.interval, 1)
let lastExec = Date.now() let lastExec = Date.now()
do { do {
if (!autoRefresh.on) { if (!autoRefresh.on) {
@ -167,6 +171,7 @@ const onTTL = () => {
<n-input-number <n-input-number
v-model:value="autoRefresh.interval" v-model:value="autoRefresh.interval"
:autofocus="false" :autofocus="false"
:default-value="2"
:disabled="autoRefresh.on" :disabled="autoRefresh.on"
:max="9999" :max="9999"
:min="1" :min="1"