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, } }