Browse Source

添加回到头部回到底部方法

xiaohaizhao 1 year ago
parent
commit
a0744ab2e9
1 changed files with 6 additions and 4 deletions
  1. 6 4
      components/My_listbox.vue

+ 6 - 4
components/My_listbox.vue

@@ -2,15 +2,17 @@
     <view class="container">
         <view id="mylisttop" />
         <scroll-view class="scroll-view" scroll-y :refresher-enabled='pullDown' :refresher-triggered='inRefresh'
-            :style="{ height: height + 'px' }" :triggered='true' @refresherrefresh='pullToRefresh' :lower-threshold='300'
+            :style="{ height: height + 'px' }" :triggered='true' @refresherrefresh='pullToRefresh'
+            :scroll-into-view="scrollIntoView" :lower-threshold='300' :scroll-with-animation="true"
             @scrolltolower='loadThePage'>
-            <view>
+            <view id="header">
                 <slot />
             </view>
             <view v-if="empty">
                 <view :style="{ height: tovw(occupyHeight) }" />
                 <u-empty :mode="mode" />
             </view>
+            <view id="bottom" />
         </scroll-view>
     </view>
 </template>
@@ -37,7 +39,8 @@ export default {
     data() {
         return {
             inRefresh: false, //下拉开启自定义项
-            height: 0
+            height: 0,
+            scrollIntoView: ""
         };
     },
     methods: {
@@ -76,5 +79,4 @@ export default {
 .scroll-view {
     position: relative;
 }
-
 </style>