微信上面导航栏
来源:互联网 发布:未来人工智能机器人 编辑:程序博客网 时间:2024/04/29 08:58
我们做微信上面部分的导航栏
看了半天别人做的
有点蒙蔽
经过研究发现就是用
导航栏中设置一个页数的属性
swiper 中的一个属性current 的属性来设置页面
点击子导航栏 获取页数 把轮播图中的current属性设置了
我们做出上面的导航栏
然后就实现我们的轮播图的页面设置
看了半天别人做的
有点蒙蔽
经过研究发现就是用
导航栏中设置一个页数的属性
swiper 中的一个属性current 的属性来设置页面
点击子导航栏 获取页数 把轮播图中的current属性设置了
我们做出上面的导航栏
然后就实现我们的轮播图的页面设置
wxml
<view class="swiper-tab">
<!-- current_tap这个是我们用来做选中的样式 data-current 我们页面的页数-->
<view class="table_list {{current_tap==0 ? 'on' : ''}}"bindtap='swichNav'data-current="0">1</view>
<view class="table_list {{current_tap==1 ? 'on' : ''}}"bindtap='swichNav'data-current="1">2</view>
<view class="table_list {{current_tap==2 ? 'on' : ''}}"bindtap='swichNav'data-current="2">3</view>
</view>
<swiperbindchange='swiper_bindchang'current='{{current_tap}}'>
<swiper-item><view>我是一号</view></swiper-item>
<swiper-item><view>我是二号</view></swiper-item>
<swiper-item><view>我是三号</view></swiper-item>
</swiper>
wxss
.swiper-tab {
width: 100%;
border-bottom: 2rpx solid#777;
text-align: center;
line-height: 80rpx;
}
.table_list {
font-size: 30rpx;
display: inline-block;
width: 33.33%;
color: #777;
}
.on{ color:#da7c0c;
border-bottom: 5rpx solid#da7c0c;}
js
// admin/swiper1/swiper1.js
Page({
/**
* 页面的初始数据
*/
data: {
current_tap:'0'
},
//把轮播图indexd页面设置为你的项目
swichNav:function(e){
var that =this;
console.log(e.target.dataset.current);
console.log(that.data.current_tap);
if(that.data.current_tap === e.target.dataset.curretn)
{
return false;
}else{
that.setData({
current_tap: e.target.dataset.current
})
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
阅读全文
0 0
- 微信上面导航栏
- 微信上抽奖的界面
- 在微信上面如何显示自己公司所有产品,连锁店的地理位置,如何调用高德云图API
- php+ajax实现微信上墙
- 微信上流传的offer待遇档次
- 在微信上,钱可以这么赚
- 在微信上,钱可以这么赚
- 微信上沉默的“僵尸关系”
- 微信上如何发送GIF动图
- 获取用户微信上的所在地
- 怎么在微信上使用预约功能
- 微信上拉加载更多事件
- 英语课程实现在微信上预约
- 微信上的网站 用HTML5获取地理位置
- 微信上测试你的人品,算八字
- 微博、微信上的假消息害苦了哥
- 微信上收藏的文章保存到evernote
- ios9学习系列(从微信上窃取的)
- intellij idea 导入github项目
- 校招资料总结
- ORACLE系列学习(1)-SQL基本数据类型
- 从0到1优雅的实现PHP多进程管理
- 17.12.24日报
- 微信上面导航栏
- PX4uORB介绍[2]-功能和接口
- 编一个程序,输入一个字符串,将组成字符串的所有非英文字母的字符删除后输出。
- 网络面试总结
- 代码规范 : 防御式编程
- 关于lua,luajit,以及lua的字节码形式
- java 开发模式之六 : 命令模式
- 【读悟人】IT人读书、悟到、成长——这才是未来完美的你
- 51Nod 1055 思维 + DP