小程序选项卡

作者: 吴乐要奋斗 | 来源:发表于2019-11-20 09:13 被阅读0次

wxml


<view style="background: #fff;">

  <view class="swiper-tab">

    <view class="swiper-tab-item" data-current="0" bindtap="clickTab">

      门店环境

      <i class=" {{currentTab==0?'active':''}}"></i>

    </view>

    <view class="swiper-tab-item" data-current="1" bindtap="clickTab">

      团队风采

      <i class=" {{currentTab==1?'active':''}}"></i>

    </view>

  </view>

  <view class="{{currentTab==0 ? 'show':'hidden'}}">

    <scroll-view>

      <view class="swiperitems">

        <image class="" src="../../images/icon_chaoshi.png"></image>

        <image class="" src="../../images/icon_chaoshi.png"></image>

      </view>

    </scroll-view>

  </view>

  <view class="{{currentTab==1 ? 'show':'hidden'}}">

    <scroll-view>

      <view class="swiperitems">

        <image class="" src="../../images/icon_ertong.png"></image>

      </view>

    </scroll-view>

  </view>

</view>

js


data {

currentTab: 0

},

//滑动切换

  swiperTab: function (e) {

    var that = this;

    that.setData({

      currentTab: e.detail.current

    });

  },

  //点击切换

  clickTab: function (e) {

    var that = this;

    if (this.data.currentTab === e.target.dataset.current) {

      return false;

    } else {

      that.setData({

        currentTab: e.target.dataset.current

      })

    }

  },

wxss


.swiper-tab-item{

  display: inline-block;

  width: 50%;

  color:#333;

}

 i.active{

display: block;

border-bottom: 6rpx solid #00B1C5;

width: 60rpx;

margin-left: 62rpx;

}

.about_page{

  margin: 0 10px;

}

.swiper-tab{

  width: 50%;

  /* border-bottom: 2rpx solid #ccc; */

  text-align: center;

  height: 50rpx;

  line-height: 50rpx;

  display: flex;

  flex-flow: row;

  justify-content: space-between;

  color: #ccc;

  font-size: 16px;

  background: #fff;

}

.swiper-tab-item{

  width: 50%; 

  color:#333;

}

.juzhong{

  margin: 0 auto;

}

.domain{

  background-color: #fff;

  height: 100%;

  margin:0 10px;

}

.show{

  display: block;

  margin: 26rpx 30rpx;

}

.hidden{

  display: none;

}

.swiperitems {

background: #fff;

  margin: 24rpx 40rpx;

}

.swiperitems image {

  margin: 0 auto 20rpx;

  width: 100%;

}

效果


相关文章

  • 1.9 电影

    1、小程序的tab选项卡 1.1 配置项目tab选项卡 app.json tabBar 如果小程序是一个多 tab...

  • 小程序的选项卡结合左右滑动

    这个是uni小程序的选项卡结合左右滑动

  • 小程序 — 选项卡

    前言:在小程序中实现选项卡的功能。GitHub:https://github.com/Ewall1106/mini...

  • 小程序选项卡

    wxml

  • 微信小程序开发-选项卡功能

    微信小程序开发中经常用到选项卡,微信没有自带的选项卡,不过可以用其他的功能组合成选项卡,非常简单。 需要用到的功能...

  • 小程序tab选项卡

    一、功能描述 在同一个页面内实现不同展示页面的切换功能,如下图所示 二、代码实现 1. index.js 2. i...

  • Excel内置的图表神器

    从插入选项卡的应用程序中获取 几个小程序介绍 Bubbles 根据数据得到动态气泡图 radial 环状条形图 p...

  • 小程序实现Tab选项卡

    前言 小程序开发中,有很多封装好的控件供开发者使用,但是,很常见的tab选项卡居然没有。。。哎,像安卓中还有Tab...

  • 微信小程序 选项卡

    html js css

  • 面向对象三

    面向对象中级 面向对象实例:选项卡 改写面向过程的选项卡image.png 改写面向对象程序的四要素 this 什...

网友评论

    本文标题:小程序选项卡

    本文链接:https://www.haomeiwen.com/subject/mpygpctx.html