微信小程序中的tab滑动切换效果如何做,代码是什么
Admin 2022-08-08 群英技术资讯 284 次浏览
自定义tab切换(可滑动)
<!--components/warn/warn.wxml--> <view class="menu"> <navigator wx:for="{{shouye}}" wx:key="index" bindtap="change" class="{{page==index?'font-white':'font-black'}}" data-pageid="{{index}}">{{item}}</navigator> <!-- <view class="order-desc">按排名升序</view> --> </view> <swiper current='{{page}}' bindchange="changepage"> <swiper-item wx:for="{{shouye}}" wx:key="index"> <view class="view1"> <view class="table"> <view class="tr"> <view class="th">产品编号</view> <view class="th">当前库存</view> <view class="th">按时间倒序</view> </view> <block wx:for="{{saleData}}" wx:key="index"> <view class="tr bg-f3f4f4"> <view class="td">{{item.prodCode}}</view> <view class="td">{{item.proName}}</view> <view class="td">{{item.time}}</view> </view> </block> <view class="all-tabledata">查看全部</view> </view> </view> </swiper-item> </swiper>
// components/warn/warn.js Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { shouye: ['未处理', '已处理'], page: 0, saleData:[ { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' }, { prodCode:38749237093280, proName:'1000', time:'2021-12-12 14:00' } ] }, /** * 组件的方法列表 */ methods: { change: function (event) { var a = event.currentTarget.dataset.pageid this.setData({ page: a }) }, changepage: function (event) { console.log(event) var a = event.detail.current this.setData({ page: a }) }, } })
/* components/warn/warn.wxss */ scroll-view{ width: 100%; height: 100%; display: flex; } .menu{ /* background-color: red; display: flex; height: 60rpx; font-size: 40rpx; line-height: 70rpx; flex-direction: row; justify-content: space-around; */ width: 100%; height: 10%; background: white; display: flex; align-items: center; justify-content: space-around; } .font-white{ display: flex; flex-direction: column; align-items: center; color: #FFFFFF; background: #197FF0; font-size: 16px; font-family: PingFang SC; font-weight: 400; width: 200rpx; height: 60rpx; line-height: 60rpx; opacity: 1; border-radius: 34rpx; } .font-black{ display: flex; flex-direction: column; align-items: center; font-size: 16px; font-family: PingFang SC; font-weight: 400; color: #041320; width: 200rpx; height: 60rpx; line-height: 60rpx; background: #F6F6F6; opacity: 1; border-radius: 34rpx; } .view1{ height: 100%; overflow-y: auto; } swiper { /* width: 100%; */ height: 90%; overflow-y: auto; /* margin: 0 auto; */ } /* 表格 */ .tr{ width: 100%; display: flex; /* justify-content: space-around; */ } .bg-f3f4f4{ margin-bottom: 20rpx; background:rgba(28, 41, 53,0.05) } .tr>.th:nth-child(1),.tr>.td:nth-child(1){ width: 40%; text-align: center; } .tr>.th:nth-child(2),.tr>.td:nth-child(2){ width: 20%; text-align: center; } .tr>.th:nth-child(3),.tr>.td:nth-child(3){ width: 40%; text-align: center; } .th,.td{ font-size: 28rpx; font-family: PingFang SC; font-weight: 400; line-height:80rpx; color: #041320; } .all-tabledata{ font-size: 24rpx; font-family: PingFang SC; font-weight: 400; height: 40rpx; line-height:30rpx; color: #187EEF; text-align: center; margin: 40rpx 0; }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
本文主要介绍vue中循环取对象数组里的值的方法,对大家学习怎么取对象数组的值有一定的参考价值,需要的朋友可了解看看,下面我们就来了解看看具体的实现代码。
常见的js事件有哪些?JS事件指再浏览器窗体或者HTML元素上发生的,乐意触发JS代码块运行的行为,这篇文章主要给大家介绍窗体事件、鼠标事件和键盘事件等等,感兴趣的朋友就接着往下看吧。
这篇文章主要介绍了vue移动端自适应适配问题,本文通过实例代码详解给大家介绍的非常详细,需要的朋友可以参考下
在项目开发过程中,因为项目的需要由时候必须要设置弹出的视图,而Angular实现的方式有哪几种呢?今天爱站技术频道小编就为大家带来了Angular弹出模态框的两种方式,一起进入下文学习吧!
这篇文章主要介绍了antdesign-vue结合sortablejs实现两个table相互拖拽排序功能,本文通过实例图文相结合给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
成为群英会员,开启智能安全云计算之旅
立即注册Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008