微信小程序> 小程序tab切换,内容高度自适应

小程序tab切换,内容高度自适应

浏览量:2350 时间: 来源:wujingj
view class='aboutusContainer'    image src='/assets/images/company.png' class='companyLogo'/image    view class='tabContainer'           text class="tab-item {{currentTab==0?'active':''}}" data-current="0" bindtap="clickTab"公司介绍/text          text class="tab-item {{currentTab==1?'active':''}}" data-current="1" bindtap="clickTab"企业资质/text          text class="tab-item {{currentTab==2?'active':''}}" data-current="2" bindtap="clickTab"发展历程/text          text class="tab-item {{currentTab==3?'active':''}}" data-current="3" bindtap="clickTab"分支机构/text    /view    view class='line'/view    view class='detailContainer'    swiper current="{{currentTab}}" class="swiper-box" duration="300" style="height: {{winHeight?winHeight+'px':'auto'}}"  bindchange="bindChange"       !-- 公司介绍页面 --     swiper-item        scroll-view scroll-y="true" style="height: {{winHeight?winHeight+'px':'auto'}}"      view class='companyProfile'        公司介绍      /view      /scroll-view      /swiper-item        swiper-item         scroll-view           view class='qualification'企业资质/view        /scroll-view      /swiper-item        swiper-item         scroll-view          view class='devHistory '发展历程/view        /scroll-view      /swiper-item        swiper-item         scroll-view           view class='branchGroup '分支机构/view        /scroll-view      /swiper-item        /swiper  /view/view--css样式--.detailContainer{  width: 90%;  height: 100%;  margin: 40rpx auto;  overflow-y: scroll;}/* 隐藏滚动条 */::-webkit-scrollbar {  display: none;}--js--// pages/aboutus/aboutus.jsPage({  data: {    // tab切换      currentTab: 0,     winWidth:0,    winHeight:0  },  /**   * 生命周期函数--监听页面加载   */  onLoad: function (options) {    var that = this;    wx.getSystemInfo({      success: function (res) {        that.setData({          winWidth: res.windowWidth,         winHeight: res.windowHeight        });      }    });  },  bindChange: 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      })    }  },})

 

版权声明

即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

产品经理

手机 : 13312967497

擅长 : 小程序流量变现

扫码领取礼包

最新资讯

热门模板

  • 头条
  • 搜狐
  • 微博
  • 百家
  • 一点资讯
  • 知乎