Эх сурвалжийг харах

fix: 优化按钮点击事件后样式

zhangyuhan 1 жил өмнө
parent
commit
2dd2acfea9

+ 9 - 0
apps/bigmember_pc/src/views/article-content/pages/Article.vue

@@ -187,14 +187,23 @@ const handleScroll = throttle((e) => {
   const canShow = headerElement?.getBoundingClientRect().top <= 0
   isFixedHeader.value = canShow
 }, 240)
+const handleFocus = () => {
+  const activeElement = document.activeElement
+  if (activeElement) {
+    activeElement.blur()
+  }
+}
 
 onMounted(() => {
   window.addEventListener('scroll', handleScroll)
   handleScroll()
+
+  document.addEventListener('visibilitychange', handleFocus)
 })
 
 onBeforeMount(() => {
   window.removeEventListener('scroll', handleScroll)
+  window.removeEventListener('visibilitychange', handleFocus)
 })
 
 const contentId = useRoute().params.id.replace('.html', '')