uniapp vu3 scroll-view 滚动到指定位置

设置 scroll-view

<scroll-view :scroll-y="true" :scroll-with-animation="true" :scroll-top="scrollTop" :style="`height:${height}px`">
    <view v-for="item in 10" :id="`box${item}`">box {
  {item}}</view>
</scroll-view>

scroll-y:设置为纵向

scroll-with-animation:在设置滚动条位置时使用动画过渡

scroll-top:设置竖向滚动条位置

如果是纵向一定要设置高度,不然不生效

scroll-view:scroll-view | uni-app官网

通过onLoad获取界面高度

const scrollTop = ref(0)
const height = ref(0)

onLoad(() => {
	height.value = uni.getSystemInfoSync().win

相关推荐

  1. uniapp vu3 scroll-view 滚动指定位置

    2024-05-15 13:04:08       11 阅读
  2. 取消uniapp的scroll-view滚动

    2024-05-15 13:04:08       15 阅读
  3. uniapp 页面滚动指定位置的方法

    2024-05-15 13:04:08       13 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-05-15 13:04:08       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-05-15 13:04:08       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-05-15 13:04:08       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-05-15 13:04:08       18 阅读

热门阅读

  1. 华为OD笔试题:API 集群负载统计

    2024-05-15 13:04:08       10 阅读
  2. 河南省市政给排水乙级资质申请费用大揭秘

    2024-05-15 13:04:08       16 阅读
  3. C++ QT设计模式:解释器模式

    2024-05-15 13:04:08       14 阅读
  4. 项目dev打包报错 Cannot find module ‘node:util‘

    2024-05-15 13:04:08       9 阅读
  5. vue和react的区别

    2024-05-15 13:04:08       13 阅读
  6. 动态IP的应用场景

    2024-05-15 13:04:08       12 阅读
  7. Rust语言内部运行原理介绍

    2024-05-15 13:04:08       10 阅读