您现在的位置是:网站首页> 编程资料编程资料
微信小程序实现tab页面切换效果_javascript技巧_
2023-05-24
323人已围观
简介 微信小程序实现tab页面切换效果_javascript技巧_
本文实例为大家分享了微信小程序实现tab页面切换的具体代码,供大家参考,具体内容如下

html 页面
第1题 第2题 第3题 第4题 第5题 第6题 单选 题目1 单选 题目2 上一题 交卷 下一题
css样式
.topic{ position: relative; color:#000; } .topic::before{ position: absolute; content:""; width:80rpx; height:6rpx; background: #1989f9; border-radius: 20rpx; bottom: 0; left:50%; transform: translateX(-50%); } .radio_singel{ background: #e6f7ff; border:1px solid #91d4fe; color:#1890ff; } .footer{ position: fixed; bottom: 0; background-color: #fff; left:0; right:0; }js 页面
data: { currentData:0, }, //获取当前滑块的index bindchange(e){ const that = this; that.setData({ currentData: e.detail.current }) }, //点击切换,滑块index赋值 checkCurrent(e){ const that = this; if (that.data.currentData === e.target.dataset.current){ return false; }else{ that.setData({ currentData: e.target.dataset.current }) } }, //上一题 prevClick(){ var currentData = this.data.currentData - 1 if(currentData + 1 == 0){ wx.showToast({ title: '这是第1题了', }) }else{ this.setData({ currentData:currentData }) } }, //下一题 nextClick(){ this.setData({ currentData:this.data.currentData + 1 }) },以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
您可能感兴趣的文章:
相关内容
- 微信小程序实现书架小功能_javascript技巧_
- 微信小程序实现滑动删除_javascript技巧_
- NodeJs Express中间件超详细讲解_node.js_
- 微信小程序实现登录注册界面_javascript技巧_
- 微信小程序实现本地分页加载_javascript技巧_
- NodeJs Express框架实现服务器接口详解_node.js_
- Openlayers实现根据半径绘制圆形_javascript技巧_
- vue3项目新用户引导组件driver.js示例详解_vue.js_
- NodeJs操作MYSQL方法详细介绍_node.js_
- Vue 2阅读理解之initRender与callHook组件详解_vue.js_
