-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] 左侧菜单无法打开 #496
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! 感谢您在这里反馈第一个问题!请务必遵循问题模板! |
Hey @nighon, I'm here to help you with any bugs, questions, or becoming a contributor. Let's squash those bugs together! 😉 要防止移动端子菜单在打开后快速收回,可以修改 function checkMobileSubAside(el: Ref<HTMLElement>) {
const { isOutside } = useMouseInElement(el)
const settingStore = useSettingStore()
const listenerEvent = () => {
if (settingStore.getMobileSubmenuState() && isOutside.value) {
// 添加延迟或条件以防止立即收回
setTimeout(() => {
if (isOutside.value) { // 在延迟后重新检查条件
settingStore.setMobileSubmenuState(false)
}
}, 300) // 延迟时间(毫秒)
}
}
settingStore.getMobileState()
? document.addEventListener('mousemove', listenerEvent)
: document.removeEventListener('mousemove', listenerEvent)
} 此外,可以使用 import { useTimeoutFn } from '@vueuse/core'
function checkMobileSubAside(el: Ref<HTMLElement>) {
const { isOutside } = useMouseInElement(el)
const settingStore = useSettingStore()
let timeout: (() => void) | undefined
const listenerEvent = () => {
if (settingStore.getMobileSubmenuState() && isOutside.value) {
timeout?.()
;({ stop: timeout } = useTimeoutFn(() => {
if (isOutside.value) {
settingStore.setMobileSubmenuState(false)
}
}, 300))
}
}
settingStore.getMobileState()
? document.addEventListener('mousemove', listenerEvent)
: document.removeEventListener('mousemove', listenerEvent)
} 这种方法使用 To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
解决了吗? |
待复查一下 |
补充:用了 useTimeoutFn 的办法后,还是不能彻底解决,偶尔会复现。 |
发现进入过用户中心后会出现这个问题,近期修复 |
为什么获取不到 const appSettings = settingStore.getSettings('app');,一直登不进去 |
这个是必须得有的,前端有一系列默认参数。 |
移动端页面宽度下,点击左侧菜单按钮,菜单打开后,鼠标放上去,很快菜单就收回去了。
发现 handleResize.ts 里面的 isOutside.value 为 true
MineAdmin/web/src/utils/handleResize.ts
Line 30 in c7598f6
The text was updated successfully, but these errors were encountered: