From 6a759f3f97c4667a9b295000039508dd73b55509 Mon Sep 17 00:00:00 2001
From: Tevin <tingquanren@163.com>
Date: Thu, 14 Jan 2021 16:52:43 +0800
Subject: [PATCH] 取消锁定页面的设计

---
 layout/h5Page/CNavBar.vue |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/layout/h5Page/CNavBar.vue b/layout/h5Page/CNavBar.vue
index b5dbf3e..b037ade 100644
--- a/layout/h5Page/CNavBar.vue
+++ b/layout/h5Page/CNavBar.vue
@@ -3,9 +3,9 @@
         <AtNavBar
             :title="title"
             leftIconType="chevron-left"
-            :onClickLeftIcon="evt=>goBack()"
+            :onClickLeftIcon="evt=>onGoBack()"
             :rightFirstIconType="dropNav ? 'bullet-list' : ''"
-            :onClickRgIconSt="evt=>dropMenu()"
+            :onClickRgIconSt="evt=>onDropMenu()"
         />
         <view
             class="c-nav-bar-drop"
@@ -18,7 +18,7 @@
                         class="c-nav-bar-drop-item item"
                         v-for="(nav,index) in dropNav"
                         :key="index"
-                        @tap="evt=>goNav(nav)"
+                        @tap="evt=>onGoNav(nav)"
                     >{{nav.title}}</view>
                 </view>
             </view>
@@ -48,10 +48,10 @@
         };
     },
     methods: {
-        goBack() {
-            window.history.go(-1);
+        onGoBack() {
+            Taro.navigateBack();
         },
-        goNav(nav) {
+        onGoNav(nav) {
             if (!nav.url) {
                 return;
             }
@@ -60,7 +60,7 @@
                 Taro.navigateTo({ url: nav.url });
             }, 0);
         },
-        dropMenu() {
+        onDropMenu() {
             this.dropShow = !this.dropShow;
             this.dropActive = true;
             clearTimeout(this.dropTimer);
@@ -69,7 +69,7 @@
             }, 500);
         },
         outCloseMenu(evt) {
-            (() => {
+            setTimeout(() => {
                 // 未打开时,忽略
                 if (!this.dropShow) {
                     return;
@@ -79,12 +79,16 @@
                     return;
                 }
                 // 点击了菜单项,忽略
-                if (evt.target.className.indexOf('c-nav-bar-drop-item') >= 0) {
+                const className = evt.target.className;
+                if (
+                    className.indexOf('c-nav-bar-drop-item') >= 0 ||
+                    className.indexOf('at-nav-bar__container') >= 0
+                ) {
                     return;
                 }
                 // 执行关闭
                 this.dropShow = false;
-            })();
+            }, 0);
         },
     },
     mounted() {

--
Gitblit v1.9.1