Browse Source

feat: 🚀 添加退出判断

pull/1/head
jiangx 3 years ago
parent
commit
b53b84139a
  1. 2
      src/base/Logout/Logout.vue
  2. 15
      src/composables/useLogout.ts
  3. 1
      tsconfig.json

2
src/base/Logout/Logout.vue

@ -1,6 +1,6 @@
<template>
<div v-if="modelValue" class="logout-container">
<div class="dialog-wrapper animate__animated animate__zoomIn">
<div class="dialog-wrapper">
<p class="out-icon" @click="close">
<img src="./chahao.svg" class="close-icon" />
</p>

15
src/composables/useLogout.ts

@ -1,10 +1,11 @@
import { ref, nextTick } from 'vue'
import { ref, nextTick, watch } from 'vue'
export const useLogout = () => {
const logout = ref(false)
const clickedNumberTotal = ref(0)
const timer = ref()
const MAX_NUMBER = 10
const DELAY_TIME = 10000
const SAFE_COORDINATES = 200
function resetClickNumber() {
@ -35,5 +36,15 @@ export const useLogout = () => {
}
}
watch(clickedNumberTotal, newVal => {
clearTimeout(timer.value)
timer.value = setTimeout(() => {
if (newVal !== 0) {
clearTimeout(timer.value)
resetClickNumber()
}
}, DELAY_TIME)
})
return { resetClickNumber, addTotalClick, setLogout, logout }
}

1
tsconfig.json

@ -6,7 +6,6 @@
"jsx": "preserve",
"moduleResolution": "node",
"skipLibCheck": true,
"ignoreDeprecations": "5.0",
"suppressImplicitAnyIndexErrors": true,
"esModuleInterop": true,
"allowJs": true,

Loading…
Cancel
Save