This commit is contained in:
zk
2023-12-18 18:34:19 +08:00
parent 2cc8886c2d
commit 580a4fc5c6
50 changed files with 2343 additions and 223 deletions
+33
View File
@@ -0,0 +1,33 @@
import { onMounted, onUnmounted, ref } from 'vue';
export function useRefresh(time = 3000, callback) {
const refreshState = ref(false);
const timer = ref(null);
function setRefreshState() {
timer.value = setInterval(() => {
refreshState.value = !refreshState.value;
callback();
}, time);
}
function stopRefresh() {
clearInterval(timer.value);
timer.value = null;
}
onMounted(() => {
if (timer.value != null) {
timer.value = null;
}
setRefreshState();
});
onUnmounted(() => {
stopRefresh();
});
return {
refreshState,
stopRefresh,
};
}
+3
View File
@@ -0,0 +1,3 @@
export default {
//预警
};