act.js
729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import App from '../../utils/api.js'
import util from '../../utils/util.js'
Component({
properties:{
item:Object
},
attached(){
console.log(this.data.item);
},
methods:{
addfood(){
this.setData({
'item.count':this.data.item.count+1
})
},
tellfood(e){
console.log(e,'yyyyyyykkkk')
if(e.detail.action=='add'){
this.addfood();
}else{
this.reducefood();
}
console.log('hahaha')
this.triggerEvent('refresh');
},
reducefood(){
this.setData({
'item.count':this.data.item.count-1
})
},
show(){
this.triggerEvent('showspec',{id:this.data.item.id});
},
showrmodal(){
console.log('rrrrrrrr')
this.triggerEvent('showrmodal',{id:this.data.item.id});
},
}
})