小程序的一个tab切换
2024-08-27 14:56:38
<view class="tab-left" bindtap="tab">
<view class="{{tabArr.curHdIndex=='0'? 'active' : ''}}" id="tab-hd01" data-id="0">tab-hd01</view>
<view class="{{tabArr.curHdIndex=='1'? 'active' : ''}}" id="tab-hd02" data-id="1">tab-hd01</view>
<view class="{{tabArr.curHdIndex=='2'? 'active' : ''}}" id="tab-hd03" data-id="2">tab-hd01</view>
<view class="{{tabArr.curHdIndex=='3'? 'active' : ''}}" id="tab-hd04" data-id="3">tab-hd01</view>
</view> <view class="tab-right">
<view class="right-item {{tabArr.curBdIndex=='0'? 'active' : ''}}">tab-bd01</view>
<view class="right-item {{tabArr.curBdIndex=='1'? 'active' : ''}}">tab-bd02</view>
<view class="right-item {{tabArr.curBdIndex=='2'? 'active' : ''}}">tab-bd03</view>
<view class="right-item {{tabArr.curBdIndex=='3'? 'active' : ''}}">tab-bd04</view>
</view>
</view>
js代码
Page( {
data: {
tabArr: {
curHdIndex: 0,
curBdIndex: 0
},
},
/**
* tab切换
*/
tab: function(e) {
var dataId = e.currentTarget.id;
var obj = {};
obj.curHdIndex = dataId;
obj.curBdIndex = dataId;
this.setData({
tabArr: obj
})
},
最新文章
- mysql 队列 实现并发读
- Appium(客户端版)解决每次运行Android,都安装Appium Setting和Unlock的方法
- 苹果IOS开发者账号总结--发布应用APP时team name是否可以随意写?
- uGUI练习 开篇
- (转载)StringGrid常用属性和常用操作
- Starting and Stopping Oracle Fusion Middleware
- VNC配置连接远程服务器桌面-linux\windows
- HDU 1131 Count the Trees
- c++构造析构顺序
- Java一流的施工顺序
- 人工智能算法综述(二) RNN and LSTM
- tcpdump常用参数说明及常见操作
- Git使用入门笔记
- 【ABP框架系列学习】N层架构(3)
- migrate数据库迁移
- A new session could not be created. (Original error: Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information)
- json&;pickle&;shelve模块
- java常见面试题及三大框架面试
- 【2】C#读取文本文件
- <;转>;HTML、CSS、font-family:中文字体的英文名称