列表切换

This commit is contained in:
pplokijuhyg 2019-12-17 09:33:03 +08:00
parent 9db2fb1c18
commit 0925c24540
3 changed files with 17 additions and 10 deletions

View File

@ -2,7 +2,14 @@ Component({
properties: {
},
data: {
id:0
},
methods: {
select(a){
// console.log(a.target.dataset.id)
this.setData({
id:a.target.dataset.id
})
}
}
})

View File

@ -1,10 +1,10 @@
<scroll-view class="navigation" scroll-y="{{true}}" >
<view class="on">热门商品</view>
<view>美容健身</view>
<view>美容健身</view>
<view>美容健身</view>
<view>美容健身</view>
<view>美容健身</view>
<view>美容健身</view>
<view>美容健身</view>
<scroll-view class="navigation" scroll-y="{{true}}" bind:tap="select" >
<view data-id="0" class="{{id == 0?'on' : ''}}">热门商品</view>
<view data-id="1" class="{{id == 1?'on' : ''}}">美容健身</view>
<view data-id="2" class="{{id == 2?'on' : ''}}">美容健身</view>
<view data-id="3" class="{{id == 3?'on' : ''}}">美容健身</view>
<view data-id="4" class="{{id == 4?'on' : ''}}">美容健身</view>
<view data-id="5" class="{{id == 5?'on' : ''}}">美容健身</view>
<view data-id="6" class="{{id == 6?'on' : ''}}">美容健身</view>
<view data-id="7" class="{{id == 7?'on' : ''}}">美容健身</view>
</scroll-view>

View File

@ -16,7 +16,7 @@
},
"compileType": "miniprogram",
"libVersion": "2.9.4",
"appid": "wx5766b7aac7c938b3",
"appid": "wxb9033316008de1ce",
"projectname": "deguodaigou",
"debugOptions": {
"hidedInDevtools": []