html 页面

<view class="bgwhite"><scroll-view scroll-x="true"><view class="width100 row nowrap"><view class="f32 c666 p-tb-20 p-lr-30 {{currentData == 0 ? 'topic' : ''}}" data-current="0" bindtap='checkCurrent'>第1题</view><view class="f32 c666 p-tb-20 p-lr-30 {{currentData == 1 ? 'topic' : ''}}" data-current="1" bindtap='checkCurrent'>第2题</view><view class="f32 c666 p-tb-20 p-lr-30 {{currentData == 2 ? 'topic' : ''}}" data-current="2" bindtap='checkCurrent'>第3题</view><view class="f32 c666 p-tb-20 p-lr-30 {{currentData == 3 ? 'topic' : ''}}" data-current="3" bindtap='checkCurrent'>第4题</view><view class="f32 c666 p-tb-20 p-lr-30 {{currentData == 4 ? 'topic' : ''}}" data-current="4" bindtap='checkCurrent'>第5题</view><view class="f32 c666 p-tb-20 p-lr-30 {{currentData == 5 ? 'topic' : ''}}" data-current="5" bindtap='checkCurrent'>第6题</view></view></scroll-view>
</view>
<swiper current="{{currentData}}" class='width100' style="height:600px;" duration="300" bindchange="bindchange"><swiper-item><view class="m-lr-20"><view class="row p-t-30 p-b-10"><view class="radio_singel f22 p-lr-10">单选</view><view class="m-l-20 weight500 f28">题目1</view></view><radio-group bindchange="radioChange"><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio checked="true" color="#1989f9"/></view><view class="f30 weight500 m-l-10">A、1111</view></label><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio color="#1989f9"/></view><view class="f30 weight500 m-l-10">B、2222</view></label><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio color="#1989f9"/></view><view class="f30 weight500 m-l-10">C、3333</view></label><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio color="#1989f9"/></view><view class="f30 weight500 m-l-10">D、4444</view></label></radio-group></view></swiper-item><swiper-item><view class="m-lr-20"><view class="row p-t-30 p-b-10"><view class="radio_singel f22 p-lr-10">单选</view><view class="m-l-20 weight500 f28">题目2</view></view><video src="" style="width:100%;"></video><radio-group bindchange="radioChange"><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio checked="true" color="#1989f9"/></view><view class="f30 weight500 m-l-10">A、1111</view></label><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio color="#1989f9"/></view><view class="f30 weight500 m-l-10">B、2222</view></label><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio color="#1989f9"/></view><view class="f30 weight500 m-l-10">C、3333</view></label><label class="row alignitems bgwhite p-tb-25 p-lr-20 radius15 m-t-20"><view class="weui-cell__hd"><radio color="#1989f9"/></view><view class="f30 weight500 m-l-10">D、4444</view></label></radio-group></view></swiper-item><swiper-item></swiper-item><swiper-item></swiper-item><swiper-item></swiper-item>
</swiper><view class="footer p-tb-25"><view class="m-lr-30 row just-btw"><view class="row alignitems" bindtap="prevClick"><image src="../../images/prev_icon.png" mode="aspectFit" style="width:48rpx;height:42rpx;"></image><view class="f36 weight500 m-l-10">上一题</view></view><view class="jiaojuanbtn f30 white p-tb-20">交卷</view><view class="row alignitems" bindtap="nextClick"><view class="f36 weight500 m-r-10">下一题</view><image src="../../images/next_icon.png" mode="aspectFit" style="width:48rpx;height:42rpx;"></image></view></view>
</view>

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,},//获取当前滑块的indexbindchange(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 - 1if(currentData + 1 == 0){wx.showToast({title: '这是第1题了',})}else{this.setData({currentData:currentData})}},//下一题nextClick(){this.setData({currentData:this.data.currentData + 1})},

微信小程序tab页面切换相关推荐

  1. PHP更新小程序,微信小程序Tab页切换更新数据详细介绍

    这篇文章主要介绍了微信小程序 Tab页切换更新数据的相关资料,需要的朋友可以参考下 微信小程序 Tab页切换更新数据 微信小程序还处于内测阶段,最不方便的莫过于官方在不停的更新,前几天写的功能隔个几天 ...

  2. 微信小程序Tab选项卡切换大集合

    代码地址如下: http://www.demodashi.com/demo/14028.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.c ...

  3. 微信小程序 - tab选项卡切换的实现方法

    页面效果 大体思路 首先是把新闻的内容,还有活动的内容都列到wxml上 然后把tab写出来.现在的难点是如何把tab和下面的内容联系起来 我们定义一个公共变量,变量名是state,当state= 'n ...

  4. navtab触底 小程序_微信小程序TAB切换效果

    微信小程序tab切换效果 话不多说,先上效果图 主要是让在一个WXML上面显示2个页面,用来分页展示东西. 直接上代码了: 首先是wxml {{item}} A页 B页 然后是wxcss样式代码 .t ...

  5. 微信小程序-tab左右滑动切换

    微信小程序-tab左右滑动切换 一.简介 1.核心思想 二.实现 1.wxml实现 2.js实现 3.wxss实现 三.参考和总结 四.优化 0.效果图 1.每个tab长度自适应 2.先前隔tab点击 ...

  6. 微信小程序 点击切换tab跟随动画

    微信小程序 点击切换tab跟随动画 <view class='tabbox'><view wx:for="{{title}}" class='tab {{curr ...

  7. 微信小程序tabar页面不触发onShow

    微信小程序tabar页面不触发onShow [场景]: 开发中,原本js里面没有onShow方法,后面加上了onShow, 除了第一次页面加载调用了onShow方法,之后切换页面都没有触发. [解决办 ...

  8. 如何实现两个微信小程序之间的切换跳转

    如何实现两个微信小程序之间的切换跳转 wx.navigateToMiniProgram({appId: '***************', //跳转目标小程序的appIdpath: '/pages/ ...

  9. 微信小程序之页面打开数量限制

    微信小程序之页面打开数量限制 无论是在小程序还是APP中,打开一个页面其实就是创建了一个新的View对象,一层层叠加的.当点击页面的回退按钮就是把当前页面关闭. 这个过程中会涉及到一个问题,就是打开页 ...

  10. 微信小程序:页面传递中文出现乱码

    微信小程序:页面传递中文 decodeURIComponent() 参考 微信小程序页面中文传参Option获取参数乱码问题

最新文章

  1. Spring 中的各种注解,光会用可不够哦!
  2. python流程控制语句-Python流程控制语句详解
  3. 网络知识:视频监控传输带宽与存储容量的计算方法
  4. 面试中的网红虚拟DOM,你知多少呢?深入解读diff算法
  5. 《走遍中国》珍藏版(二)
  6. [html] 当页面中使用application/xhtml+xml会出现什么问题吗?
  7. EJB是什么?EJB的概念分析与理解(copy)
  8. SQL导出数据到EXCEL的问题
  9. 任正非就“注册姚安娜商标”事件道歉:为防恶意抢注,第一次公权私用
  10. 森林图怎么分析_新疆森林消防总队特勤大队:“火焰蓝”备战春防,我们时刻准备着!...
  11. java中一直gc_如果JVM在执行GC时一直在移动对象,那么它如何解析引用?
  12. 如何做相册_苹果手机相册不想让人看怎么办?看这里教你加密
  13. [ZT]Addison Wesley's Free Chapters and Articles
  14. git命令详解( 六 )
  15. Rabbitmq 延迟队列
  16. python3 与python2 异常处理的区别与联系
  17. 【现已失效】【转载】QQ空间一键点赞方法
  18. linux之文件压缩解压
  19. HFSS初探日志(六)被动毫米波成像系统馈源天线
  20. leetcode 183. Customers Who Never Order

热门文章

  1. 经典的日语歌曲被翻唱成国语
  2. 谷歌雅虎将联手实行即时信息兼容性计划
  3. 计算机毕业设计ssm宠物寄存中心计时收费系统
  4. 在中国移动(中国联通、中国电信)工作是一种怎样的体验?
  5. 【SpringCloud】 - Feign 踩坑记录:404 ,调用不成功 , 接口定义规范 等问题记录
  6. 虚拟现实大作业——太阳系
  7. 一文详解IBM SPSS Modeler 18.0安装教程
  8. 作为学生,我是怎么半年赚到人生第一个三十万的
  9. SIM800C实验记录之熟悉AT命令
  10. rti matlab,dSPACE-RTI知识介绍.pdf