Heim  >  Fragen und Antworten  >  Hauptteil

Das WeChat-Applet kann auf der linken Seite nicht angeklickt werden und die Schriftart und der Hintergrund ändern ihre Farbe.

Page({

data: {

activeId:2,

typelist:[

{

id:1,

title:"家具"}, {

id:2,

title: "家具"}, {

id:3,

title: "家具"}, {

id:4,

title: "家具" }, {

id:5,

title: "家具"

}

]

},

onLoad: Funktion (Optionen) {

},

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{

width: 250rpx;

background: #eee;

height: 1000rpx;

}

.linke Ansicht{

padding: 10px 0px;

text-align: center;

}

.left view.active{

color: burlywood;

background: #fff;

}

.right{

flex: 1;

}

.comtainer{

display: flex;

min-height: 100vh;

}

UotogeletyUotogelety1624 Tage vor1107

Antworte allen(0)Ich werde antworten

Keine Antwort
  • StornierenAntwort