当前位置:网站首页>【uni-app】uni-app中scroll-into-view的使用
【uni-app】uni-app中scroll-into-view的使用
2022-07-28 05:19:00 【Tree_wws】
uni-app中scroll-into-view的使用
uni-app中scroll-into-view的使用
在使用的时候需要注意:
需要给sroll-view组件设置宽或者高(根据横纵情况)
white-space:nowrap 这行代码让组件能够滑动(之前自己写的时候踩的坑)
使用scroll-into-view,需要开启动画效果,并且动态绑定的值必须是字符串
并且子组件的上绑定一个id值用于定位

<template>
<view class="scroll-wrapper">
<scroll-view
scroll-x="true"
class="scroll"
enable-flex='true'
scroll-with-animation
:scroll-into-view="'tab'+ tabId">
<view :id="'tab'+index" :class="active == index ? 'active' :''"
v-for="(item,index) in navList"
:key="index"
@click="selectActive(index)">{
{
item}}</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
active:0,
tabId:0
}
},
methods:{
selectActive(index){
this.active = index
this.tabId = index
}
}
}
</script>
总结
以上就是今天要讲的内容,希望对大家有所帮助!!!
边栏推荐
猜你喜欢

树莓派WIFI一键连接配置

Invalid bound statement (not found): com.exam.mapper.UserMapper.findbyid

Idea uses dev tool to realize hot deployment

Mutual conversion between latex and word

visio如何精确控制图形的大小和位置及角度

DOM--事件链、事件冒泡和捕获、事件代理

Shell operation principle

You must configure either the server or JDBC driver (via the ‘serverTimezone)

Merge two ordered arrays of order table OJ

Centos7 install MySQL 5.7
随机推荐
IO流的使用
RESNET structure comparison
深度学习医学图像模型复现
树莓派WIFI一键连接配置
函数基础知识以及特殊点
GD32F407 移植FreeRTOS+Lwip
SVG了解与绘图应用
日期类及其基本功能的实现
How Visio accurately controls the size, position and angle of graphics
When using \hl for highlighting, latex always reports an error when encountering a reference, showing that there are fewer or more parentheses
Feignclient calls the get method and reports an error resultvo{result= unknown exception. Exception details: request method 'post' not supported
URL form
排序之插入排序
Pytorch uses hook to get feature map
Advanced multithreading: the role and implementation principle of volatile
Mutual conversion between latex and word
顺序表oj题目
When using deep learning training image, the image is too large for segmentation training prediction
Arrangement of main drawings of the latest 54 papers of eccv22
冶金物理化学复习 --- 冶金反应动力学基础与多相反应动力学特征