当前位置:网站首页>【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>
总结
以上就是今天要讲的内容,希望对大家有所帮助!!!
边栏推荐
猜你喜欢

Advanced multithreading: the role and implementation principle of volatile

JUC notes

The difference between get and post

Shell operation principle

冶金物理化学复习 --- 复杂反应的速率方程

顺序表的增删查改

Advanced multi threading: the underlying principle of synchronized, the process of lock optimization and lock upgrade

How Visio accurately controls the size, position and angle of graphics

对极大似然估计、梯度下降、线性回归、逻辑回归的理解

链表中关于快慢指针的oj题
随机推荐
Openjudge: campus accommodation reservation system
蒸馏模型图
Review of metallurgical physical chemistry --- liquid liquid reaction kinetics
标准C语言总结1
Openjudge: judge whether the string is palindrome
Review of metallurgical physical chemistry -- rate equations of complex reactions
图片根据屏幕自适应
冶金物理化学复习 ---- 气固反应动力学
Database interview
es6新增数据类型--->Symbol、Map、Set
openjudge:大小写字母互换
The way of deep learning thermodynamic diagram visualization
The essence of dynamic convolution
Lamda gets the current number of cycles, atomicinteger
冶金物理化学复习 --- 化学反应动力学基础
Canvas绘图1
JS字符串方法大全
深度学习热力图可视化的方式
记录某某小卢的第一篇文章
Mutual conversion between latex and word