This commit is contained in:
2019-12-24 16:32:27 +08:00
parent 68a7aea72c
commit f9ef1a34bd
34 changed files with 136 additions and 55 deletions

View File

@@ -1,16 +1,17 @@
Component({
properties: {
types: Array
types: Array,
ids: Number
},
data: {
id: 0
},
methods: {
select(a) {
// console.log(this.data.a.target.dataset.id)
// console.log(a.target.dataset.id)
this.setData({
id: a.target.dataset.id
ids: a.target.dataset.id
})
this.triggerEvent("select",{id:a.target.dataset.id})
}

View File

@@ -1,5 +1,6 @@
<scroll-view class="navigation" scroll-y="{{true}}" bind:tap="select" >
<view wx:for="{{types}}" data-id="{{index}}" class="{{id == index?'on' : ''}}">{{item.name}}</view>
<!-- {{ids}} -->
<view wx:for="{{types}}" data-id="{{item.id}}" class="{{ids == item.id?'on' : ''}}">{{item.name}}</view>
<!-- <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>