// 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' }) } } })