代码地址如下:
http://www.demodashi.com/demo/14028.html

一、前期准备工作

软件环境:微信开发者工具
官方下载地址:https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html

1、基本需求。
  • 实现用户自定义弹框
  • 带动画(动画可做参靠,个人要是觉得不好看可以自定义动画)
  • 获取弹出框的内容,自定义事件获取
2、案例目录结构

二、程序实现具体步骤

1.选项卡xxx.wxml代码

a.tab1代码

<view class="navbar"><view class="navbar-item" wx:for="{{navbar}}" wx:for-index="idx" wx:key="" data-idx="{{idx}}" bindtap="swichNav"><text class="navbar-text {{currentNavbar==idx ? 'active' : ''}}">{{item}}</text></view>
</view>
<navigator url="/pages/index/index" hover-class="hover"><button class="btn-index">首页</button>
</navigator>

b.tab2代码

<view class="wrap" bindtouchstart="touchStart" bindtouchend="touchEnd"><view class="nav-item {{testClass[index]}}" wx:for="{{testNav}}" wx:key="" data-index="{{index}}"><view>{{item.word}}</view></view></view>
<navigator url="/pages/index/index" hover-class="hover"><button class="btn-index">首页</button>
</navigator>

c.tabbar代码

<!--pages/tabbar/tabbar.wxml-->
<import src="../../template/list.wxml"/><view class="geekxz-tabbar-content"><view class="geekxz-tabbar-group"><text data-id="0" bindtap="changeTabbar" class="geekxz-tabbar-cell {{index == 0 ? 'geekxz-active' : ''}}">已获得赏金</text><text data-id="1" bindtap="changeTabbar" class="geekxz-tabbar-cell {{index == 1 ? 'geekxz-active' : ''}}">赏金在路上</text><text data-id="2" bindtap="changeTabbar" class="geekxz-tabbar-cell {{index == 2 ? 'geekxz-active' : ''}}">邀请失败</text></view>
</view>
<view class="geekxz-list-box {{index == 0 ? '' : 'geekxz-hide'}}"><template wx:for="{{['选项卡一子选项 - 1','选项卡一子选项 -  2','选项卡一子选项 - 3','选项卡一子选项 - 4','选项卡一子选项 - 5','选项卡一子选项 - 6','选项卡一子选项 - 7','选项卡一子选项 - 8']}}" is="listNoneOnly" data="{{item}}" wx:key=""></template>
</view>
<view class="geekxz-list-box {{index == 1 ? '' : 'geekxz-hide'}}"><template wx:for="{{['选项卡二子选项 - 1','选项卡二子选项 -  2','选项卡二子选项 - 3','选项卡二子选项 - 4','选项卡二子选项 - 5']}}" is="listNoneOnly" data="{{item}}" wx:key=""></template>
</view>
<view class="geekxz-list-box {{index == 2 ? '' : 'geekxz-hide'}}"><template wx:for="{{['选项卡三子选项 - 1','选项卡三子选项 -  2','选项卡三子选项 - 3']}}" is="listNoneOnly" data="{{item}}" wx:key=""></template>
</view>
<navigator url="/pages/index/index" hover-class="hover"><button class="btn-index">首页</button>
</navigator>
2.xxx.wxss代码
.wrap{margin-top: 20rpx;color: #999;position: relative;width: 750rpx;height: 250rpx;border-top:1px solid #ccc;border-bottom:1px solid #ccc;}.nav-item{margin-top:10px;width: 400rpx;height: 200rpx;box-shadow: 0 0 5rpx #e24233;padding: 5rpx;transition: all 0.5s;word-break:break-all;background-color: snow;
}.prev{position: absolute;transform: scale(0.8);left: -280rpx;margin-right: 55rpx;
}.current{position: absolute;left: 50%;margin-left: -200rpx;}.next{position: absolute;left:620rpx;top: 0;transform: scale(0.8);z-index: 10;
}.next+.next{z-index: -1;background-color: deepskyblue;
}
3.部分xxx.js逻辑代码

a.部分的功能实现

swipNext (e) {flag++;if (flag < this.data.testNav.length){for (var i = 0; i < this.data.testNav.length; i++) {if (i == flag) {classCatch[i] = 'current';} else if (i < flag) {classCatch[i] = 'prev';} else {classCatch[i] = 'next';}}this.setData({testClass: classCatch})}else{flag = this.data.testNav.length-1;}},swipPrev(e) {flag--;if (flag+1 > 0 ) {for (var i = 0; i < this.data.testNav.length; i++) {if (i == flag) {classCatch[i] = 'current';} else if (i < flag) {classCatch[i] = 'prev';} else {classCatch[i] = 'next';}}this.setData({testClass: classCatch})} else {flag = 0;}}

三、案例运行效果图


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

代码地址如下:
http://www.demodashi.com/demo/14028.html

注:本文著作权归作者,由demo大师发表,拒绝转载,转载需要作者授权

微信小程序Tab选项卡切换大集合相关推荐

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

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

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

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

  3. 微信小程序tab选项卡,点击弹窗(带蒙版)五星好评-获取微信手机号码

    <!--pages/index/received/received.wxml--> <view class="swiper-tab"><view cl ...

  4. 微信小程序 tab选项卡,可点击,可滑动

    看下效果图: <view class="swiper-tab"><view class="swiper-tab-item {{currentTab==0 ...

  5. 微信小程序:选项卡切换内容效果

    wxml: <view class="swiper-tab"><view class="swiper-tab-list {{currentTab==0 ...

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

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

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

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

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

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

  9. 微信小程序 顶部 选项卡 tabs 下拉刷新

    微信小程序 顶部 选项卡 tabs 下拉刷新 **首先 wxml 页面 带swiper 滑动切换功能 ** <!--pages/my/my.wxml--> <view class=& ...

最新文章

  1. date样式找不到_涡轮+国VI排放,顶配售价不到12万,家用轿车看它准没错
  2. nginx利用proxy_cache来缓存文件
  3. eclipse/myeclipse中如何开启断言调试代码
  4. vnc报错 font catalog is not properly configured
  5. idea没有代码自动提示功能和包自动引入不了问题
  6. 华为Mate30 5G评测:首款5G爆品, 一步到位兼容5G双模全网通
  7. 面试题:String StringBufere StringBuilder 不用看
  8. linux 一句话备忘
  9. android 开发种子文件,IT之家学院:如何制作种子文件和磁力链接
  10. w ndows10怎么关闭启动项,Windows10系统移除启动项无用项目的三种方法
  11. appstore app 下载地址
  12. win7 修复计算机无法进入系统,win7开机自动诊断修复无法进入系统重启无效的故障解决...
  13. 鸿蒙系统宣传标语,有多项新功能加持,搭载鸿蒙系统的华为手表WATCH 3来了!...
  14. iTunes Connect 人员如何使用testflight安装测试版ios应用
  15. cmmi实践访谈测试ppt_CMMI模型基础知识考试试题-(标准答案).xls
  16. 国内AdSense/Youtube如何回款?AdSense/Youtube无限额结汇
  17. iPad 使用技巧:备忘录
  18. WordPress正确使用51la统计来统计网站访问数据[WP教程]
  19. opencv 凸包convexHull、道格拉斯-普克算法Douglas-Peucker algorithm、approxPloyDP 函数
  20. 为表中的某个字段添加check约束

热门文章

  1. 测试驱动开发_?使用jest进行测试驱动开发
  2. 如何在单元里植入图片html,单元格用HTML显示图片
  3. Nginx基本数据结构之ngx_chain_t
  4. mini6410 uboot board.c 分析
  5. tcp与udp的socket编程,udp代码实现客户端服务端,tcp代码实现客户端服务端(单线程、多线程、多进程分别实现),三次握手
  6. java实验检查危险品代码_2019JAVA第六次实验报告
  7. 【LeetCode】剑指 Offer 34. 二叉树中和为某一值的路径
  8. LeetBook《程序员的算法趣题》Q18---水果酥饼日
  9. ML_Review_PCA(Ch4)
  10. hive学习07-常见的优化