当前位置:   article > 正文

uniapp小程序中scroll-view滑动类似锚点链接 直接定位到某一点_uniapp scroll-view 锚点链接

uniapp scroll-view 锚点链接

1.scroll-view标签上加上:scroll-into-view="'scan'+goindex"属性

  1. <scroll-view style="height: 100%;padding-bottom: 100rpx;" scroll-y @scrolltolower="onreachBottom"
  2. :scroll-top="scrollTop" :refresher-enabled="false" :refresher-triggered="triggered"
  3. :refresher-threshold="50" refresher-background="#f8f8f8" @refresherrefresh="onRefresh"
  4. :scroll-into-view="'scan'+goindex" @scroll="scrolling" @refresherrestore="onRestore"> 内容</scroll-view>

2.直接给goindex赋值(注意:goindex就是唯一值)定位到数据的唯一值

注意:scroll-into-view后面添加一个自定义的字符串再加上唯一值

使用文档:scroll-view | uni-app官网

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/312527
推荐阅读
相关标签
  

闽ICP备14008679号