Page({
数据: {
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 wx:for="{{typelist}}" class="{{itme.id==activeId?'active':''}}"
bindtap="selectType" data-Id="{{item.id}}">
{{item.title}}
------------ -----------------------
wxss
.left{
宽度:250rpx;
背景:#eee;
高度:1000rpx;
}
.左视图{
padding :10px 0px;
文本对齐:居中;
}
.left view.active{
颜色:burlywood;
background: #fff;
}
.right{
flex: 1;
}
.comtainer{
显示:flex;
最小高度:100vh;
}