2019-12-13 11:59:11 +08:00
|
|
|
// components/shopping/shoppingitem/shoppingitem.js
|
|
|
|
Component({
|
|
|
|
/**
|
|
|
|
* 组件的属性列表
|
|
|
|
*/
|
|
|
|
properties: {
|
2019-12-19 15:27:30 +08:00
|
|
|
shopname: String,
|
2019-12-13 11:59:11 +08:00
|
|
|
shopdesc: String,
|
|
|
|
price: Number,
|
|
|
|
pic: String
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
2019-12-17 09:54:17 +08:00
|
|
|
num: 5
|
2019-12-13 11:59:11 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的方法列表
|
|
|
|
*/
|
|
|
|
methods: {
|
2019-12-17 09:54:17 +08:00
|
|
|
rm() {
|
|
|
|
if (this.data.num == 0) {
|
|
|
|
return
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
num: this.data.num - 1
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
add() {
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
num: this.data.num + 1
|
|
|
|
})
|
|
|
|
}
|
2019-12-13 11:59:11 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
})
|