求求大家帮我看看,错在哪里了?结构文件index.wxml
<view>
<scroll-view class="left-navbar" scroll-y>
<view wx:for="{{navitems}}" class="{{curNav == index? `active` : ``}}" bindtop="leftclick" data-index="{{index}}">{{item}}</view>
</scroll-view>
<scroll-view class="right" scroll-y>
<image style="height: 25%;" src="/pages/images/4.jpg"></image>
<view wx:for="{{navitems}}">{{item}}</view>
</scroll-view>
</view>
格式文件index.wxss
.left-navbar view{
height: 80rpx;
line-height: 80rpx;
text-align: center;
}
.active{
background-color: #fff;
color: red;
font-size: 17px;
}
.right {
position: absolute;
right: 0;
width: 75%;
height: 100%;
background-color: rgb(241, 203, 209);
font-size: 15px;
}
方法文件index.js
Page({
data: {
navitems: [`手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, `手表`, ]
},
curNav:0,
leftclick:function(e){
var index = e.target.dataset.index
console.log(index)
this.setData({
curNav:index
})
},
curNav:0,
写错地方了
先学一下怎么添加代码