Page({
data: {
activeId:2,
typelist:[
{
id:1,
title:"가족具"}, {
id:2,
title: " 가택"}, {
id:3,
title: "가구"}, {
id:4,
title: "가구" }, {
id:5,
title: "가구"
}
]
},
onLoad: 함수(옵션) {
},
selectType(e){
this.setData({
activeId: e.currentTarget.dataset.id
})
}
})
--------------------------------------
wxml
<view class="container">
<view class="left">
<view wx:for="{{typelist}}" class="{{itme.id ==activeId?'active':''}}"
bindtap="selectType" data-Id="{{item.id}}">
{{item.title}}
</view> ;</view>
<view class="right"></view>
</view>
---------------- ------
wxss
.left{
너비: 250rpx;
배경: #eee;
높이: 1000rpx;
}
.왼쪽 보기{
padding: 10px 0px;
text-align: center;
}
.left view.active{
color: burlywood;
배경: #fff;
}
.right{
flex: 1;
}
.comtainer{
display: flex;
min-height: 100vh;
}