微信小程序自定義可滑動(dòng)的tab切換
本文實(shí)例為大家分享了微信小程序自定義tab切換(可滑動(dòng)),供大家參考,具體內(nèi)容如下
自定義tab切換(可滑動(dòng))

<!--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">產(chǎn)品編號(hào)</view>
? ? ? ? ? <view class="th">當(dāng)前庫(kù)存</view>
? ? ? ? ? <view class="th">按時(shí)間倒序</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: {
? ? },
? ? /**
? ? ?* 組件的初始數(shù)據(jù)
? ? ?*/
? ? 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;
}以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
原生js實(shí)現(xiàn)對(duì)Ajax的封裝(仿jquery)
這篇文章主要為大家詳細(xì)介紹了原生js實(shí)現(xiàn)對(duì)Ajax的封裝,模仿jquery,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-01-01
利用Query+bootstrap和js兩種方式實(shí)現(xiàn)日期選擇器
日期選擇器在我們平時(shí)開(kāi)發(fā)的時(shí)候經(jīng)常要用到,下面這篇文章主要給大家介紹了利用Query+bootstrap和js這兩種方式實(shí)現(xiàn)日期選擇器的方法,文中兩種方法都給出了詳細(xì)的示例代碼,有需要的朋友可以參考借鑒,下面來(lái)一起看看吧。2017-01-01
詳細(xì)聊聊TypeScript中unknown與any的區(qū)別
unknown類型比較謙虛,就和他本身的意思一樣,他從不禍害到其他的變量,但是any類型就是那種惡霸,屬于什么都不管,誰(shuí)也不敢管的類型,這篇文章主要給大家介紹了關(guān)于TypeScript中unknown與any區(qū)別的相關(guān)資料,需要的朋友可以參考下2021-10-10
淺談JavaScript窗體Window.ShowModalDialog使用
這篇文章主要介紹了淺談JavaScript窗體Window.ShowModalDialog使用,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07
JavaScript實(shí)現(xiàn)模塊拖拽功能的代碼示例
這篇文章將給大家詳細(xì)介紹一下JavaScript實(shí)現(xiàn)模塊的拖拽功能的代碼示例,文中有詳細(xì)的實(shí)現(xiàn)步驟,需要的朋友可以參考下2023-07-07
基于Echarts 3.19 制作常用的圖形(非靜態(tài))
這篇文章主要介紹了基于Echarts 3.19 制作常用的圖形(非靜態(tài))的相關(guān)資料,需要的朋友可以參考下2016-05-05
通過(guò)layer實(shí)現(xiàn)可輸入的模態(tài)框的例子
今天小編就為大家分享一篇通過(guò)layer實(shí)現(xiàn)可輸入的模態(tài)框的例子,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-09-09
javascript數(shù)組中的reduce方法和pop方法
這篇文章主要介紹了javascript數(shù)組中的reduce方法和pop方法,文章內(nèi)容介紹詳細(xì),具有一定的參考價(jià)值需要的小伙伴可以參考一下,希望對(duì)你的學(xué)習(xí)有所幫助2022-03-03

