浏览代码

fix: clicking tabs jump to top

Tienson Qin 2 月之前
父节点
当前提交
a46bae3ace
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      src/main/mobile/components/ui_silk.cljs

+ 2 - 3
src/main/mobile/components/ui_silk.cljs

@@ -26,8 +26,6 @@
   (let [[current-tab set-tab!] (mobile-state/use-tab)]
   (let [[current-tab set-tab!] (mobile-state/use-tab)]
     [:div.app-silk-tabs
     [:div.app-silk-tabs
      {:on-pointer-down (fn [^js e]
      {:on-pointer-down (fn [^js e]
-                         (when (= current-tab "home")
-                           (util/scroll-to-top false))
                          (some-> (.-target e)
                          (some-> (.-target e)
                                  ^js (.closest ".as-item")
                                  ^js (.closest ".as-item")
                                  ^js (.-dataset)
                                  ^js (.-dataset)
@@ -35,7 +33,8 @@
      [:span.as-item
      [:span.as-item
       {:class (when (= current-tab "home") "active")
       {:class (when (= current-tab "home") "active")
        :data-tab "home"}
        :data-tab "home"}
-      (shui/button {:variant :icon}
+      (shui/button {:variant :icon
+                    :on-pointer-down (fn [] (util/scroll-to-top false))}
                    (shui/tabler-icon "home" {:size 24}))
                    (shui/tabler-icon "home" {:size 24}))
       [:small "Journals"]]
       [:small "Journals"]]
      [:span.as-item
      [:span.as-item