Files
CompanyProject/衣莎项目/源码/YiShaXiYi/component/quantityClothes/quantityClothes.js
2024-09-27 01:32:49 +08:00

44 lines
699 B
JavaScript

// component/quantityClothes/quantityClothes.js
Component({
/**
* 组件的属性列表
*/
properties: {
isTips: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
num: 0
},
/**
* 组件的方法列表
*/
methods: {
reduce() {
let num = --this.data.num
this.setData({
num: num <= 0 ? 0 : num
})
},
add() {
this.setData({
num: ++this.data.num
})
},
chCount() {
this.triggerEvent('chCount', { num: this.data.num })
},
closeTips() {
this.properties.isTips = false
this.triggerEvent('chCount', { isTips: 'close' })
}
}
})