act.js 729 Bytes
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});
		},
	}
})