You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
40 lines
1.0 KiB
import { ElMessageBox } from 'element-plus'
|
|
import { useSystemStore } from 'stores/systemStore'
|
|
import { ref } from 'vue'
|
|
|
|
import router from '@/router'
|
|
|
|
export const useActivateDebug = () => {
|
|
const systemStore = useSystemStore()
|
|
const logoClickCount = ref(0)
|
|
let clickTimeout: NodeJS.Timeout | null = null
|
|
|
|
const handleLogoClick = () => {
|
|
if (clickTimeout) {
|
|
clearTimeout(clickTimeout)
|
|
}
|
|
logoClickCount.value++
|
|
if (logoClickCount.value === 10) {
|
|
console.log('isDebug', systemStore.isDebug)
|
|
ElMessageBox.confirm('确认重新加载?', '提示', {
|
|
confirmButtonText: '确认',
|
|
cancelButtonText: '取消',
|
|
closeOnClickModal: false,
|
|
type: 'warning',
|
|
})
|
|
.finally(() => {
|
|
logoClickCount.value = 0 // 重置计数器
|
|
})
|
|
.then(async () => {
|
|
await router.push('/home')
|
|
location.reload()
|
|
})
|
|
}
|
|
clickTimeout = setTimeout(() => {
|
|
logoClickCount.value = 0 // 重置计数器
|
|
}, 1000)
|
|
}
|
|
return {
|
|
handleLogoClick,
|
|
}
|
|
}
|