Selaa lähdekoodia

计件宝兼容安卓7.1及以上

zh 9 kuukautta sitten
vanhempi
commit
78adabd671
1 muutettua tiedostoa jossa 15 lisäystä ja 10 poistoa
  1. 15 10
      src/views/piece/dashboard/index.vue

+ 15 - 10
src/views/piece/dashboard/index.vue

@@ -96,7 +96,7 @@
               <div class="col operator">{{ item.operatorName }}</div>
               <div class="col content">{{ item.deliveryNo }}</div>
             </div>
-            <van-back-top />
+            <van-back-top @click="scrollTop"/>
           </van-list>
         </van-pull-refresh>
       </div>
@@ -323,15 +323,7 @@ const _handlerScan = (code) => {
       showNotify({ type: 'danger', style: 'font-size: 30px !important;height:50px', message: '请扫描正确的快递单号!' });
       return
     }
-    // 添加滚动到顶部的逻辑
-    nextTick(() => {
-      if (pullRefreshRef.value.$el) {
-        pullRefreshRef.value.$el.scrollTo({
-          top: 0,
-          behavior: 'smooth' // 平滑滚动效果
-        })
-      }
-    })
+    scrollTop()
     // 校验是否已登录
     if (!userInfo.value.userId) {
       scanError()
@@ -423,6 +415,18 @@ const _handlerScan = (code) => {
   }
 }
 
+const scrollTop = () => {
+  // 添加滚动到顶部的逻辑
+  nextTick(() => {
+    const el = pullRefreshRef.value?.$el;
+    if (el && el.scrollTo) {
+      el.scrollTo({ top: 0, behavior: 'smooth' });
+    } else if (el) {
+      // 回退方案
+      el.scrollTop = 0;
+    }
+  })
+}
 function fixDuplicateText(input) {
   // 改进版正则表达式(支持任意字符且精确匹配完全重复)
   const regex = /^(.+?)\1$/; // 非贪婪模式防止误匹配
@@ -803,6 +807,7 @@ span
   .van-cell__title
     flex: 0 0 30px !important
     font-size: 10px
+    line-height: 24px
     max-width: 70px
     min-width: 70px
   .van-cell__value