>  기사  >  웹 프론트엔드  >  WeChat 애플릿에서 YDUI의 ScrollTab 구성 요소를 사용하는 방법

WeChat 애플릿에서 YDUI의 ScrollTab 구성 요소를 사용하는 방법

亚连
亚连원래의
2018-06-08 11:42:381999검색

이 글은 주로 YDUI의 ScrollTab 컴포넌트와 스크롤 탭 효과를 구현하기 위한 WeChat 애플릿을 자세히 소개합니다. 관심 있는 친구들이 참고할 수 있습니다.

이 글의 예는 WeChat 애플릿을 모든 사람과 공유하는 것입니다. 스크롤 탭 효과를 구현하는 코드는 참고용입니다. 구체적인 내용은 다음과 같습니다

DEMO download

Rendering

YDUI의 ScrollTab(스크롤 탭)

WXML

<!--导航 -->
<view class="tui-fixed-left">
 <scroll-view class="tui-city-scroll" scroll-x="true">
  <text bindtap="getStatus" id="NAV{{index}}" class="tui-nav-li {{index === status ? &#39;tui-nav-active&#39; : &#39;&#39;}}" data-index="{{index}}" wx:for="{{navList}}">{{item}}</text>
 </scroll-view>
</view>
<!--列表滚动区 -->
 <view class="tui-fixed-y">
 <scroll-view class="tui-city-scroll-y" scroll-y="true" scroll-into-view="NAV{{status}}" scroll-with-animation="true">
  <view wx:for="{{navList}}">
   <view id="NAV{{index}}" class="tui-list-head">{{item}}</view>
   <view class="tui-list-li">{{item}} 列表 {{index}}</view>
  </view>
 </scroll-view>
</view>

WXSS

.tui-fixed-x{
 margin-left: 130px;
 position: fixed;
 top: 0;
 left: 0;
}
.tui-fixed-left{
 width: 120px;
 height: 100%;
 border-right: 1px solid #dfdfdf;
 position: fixed;
 background-color: #f5f5f5;
 top: 0;
 left: 0;
}
.tui-list-head{
 background-color: #fff;
 margin-bottom: 15px;
}
.tui-city-scroll{
 width: 100%;
}
.tui-nav-li{
 font-size: 30rpx;
 padding: 0 10px;
 height: 100rpx;
 line-height: 100rpx;
 width: 100px;
 display: block;
 border-bottom: 1px solid #dfdfdf;
 position: relative;
 z-index: 10;
}
.tui-nav-active{
 background-color: #fff;
}

.tui-fixed-y{
 margin-left: 120px;
 padding-left: 10px;
 padding-right: 10px;
 height: 100%;
 position: fixed;
 bottom: 0;
 right: 0;
}
.tui-city-scroll-y{
 height: 100%;
 box-sizing: border-box;
}
.tui-list-head{
 height: 50px;
 line-height: 50px;
 text-align: center;
 font-size: 30rpx;
 color: blue;
}
.tui-list-li{
 height: 400px;
 padding: 10rpx;
 color: #fff;
 font-size: 50rpx;
 background-color: lightgreen;
}

JS

Page({
 data: {
  navList: [&#39;今日特惠&#39;, &#39;烟灶推荐&#39;, &#39;净水饮水推荐&#39;, &#39;洗碗机推荐&#39;, &#39;电热推荐&#39;, &#39;燃热推荐&#39;, &#39;消毒柜推荐&#39;, &#39;嵌入式推荐&#39;, &#39;商用电器&#39;, &#39;活动说明&#39;],
  status: 0
 },
 getStatus(e) {
  this.setData({ status: e.currentTarget.dataset.index })
 }
})

위 내용은 다음과 같습니다. 저는 모든 사람을 위해 이 글을 편집했습니다. 앞으로 모든 사람에게 도움이 되기를 바랍니다.

관련 기사:

vue에서 이미지 로딩 구성 요소를 구현하는 방법

Node.js가 웹 애플리케이션 개발이 되는 이유는 무엇입니까?

Node.js에서 파일 업로드 진행 상황을 확인하는 방법은 무엇입니까?

위 내용은 WeChat 애플릿에서 YDUI의 ScrollTab 구성 요소를 사용하는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.