近期项目要做Tabs标签栏,项目中用的是Vant Weapp组件库,但是vant中的tabs不符合项目的要求。因此,用了自定义的组件。
效果:
.wxml
<scroll-view class='component cus' scroll-x="{
{ isScroll }}">
<view class='content'>
<view class='item' data-cus="{
{ dataCus[index] }}" data-index="{
{ index }}" data-value="{
{ item }}" wx:for="{
{ items }}" wx:key="index" wx:for-item="item" style='min-width: {
{ itemWidth }}rpx; height: {
{ height }}rpx' catchtap='onItemTap'>
<text class='text' style='color: {
{ mSelected == index ? selectTextColor : textColor }};font-size: {
{ textTopSize }