|
@@ -60,7 +60,7 @@ Component({
|
|
tabBarPadding: {
|
|
tabBarPadding: {
|
|
type: Boolean,
|
|
type: Boolean,
|
|
value: false,
|
|
value: false,
|
|
- observer(b){
|
|
+ observer(b) {
|
|
console.log(b);
|
|
console.log(b);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -91,15 +91,15 @@ Component({
|
|
addCommentNum({
|
|
addCommentNum({
|
|
detail
|
|
detail
|
|
}) {
|
|
}) {
|
|
- let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
|
|
+ let worksListCopy = this.data.worksListCopy
|
|
- worksListCopy.forEach(item => {
|
|
+ let index = worksListCopy.findIndex(item => {
|
|
- if (item.userRead.id == detail) {
|
|
+ return item.userRead.id == detail
|
|
- item.userRead.commentAmount = ++item.userRead.commentAmount
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- this.setData({
|
|
|
|
- worksListCopy
|
|
|
|
})
|
|
})
|
|
|
|
+ if (index != -1) {
|
|
|
|
+ this.setData({
|
|
|
|
+ [`worksListCopy[${index}].userRead.commentAmount`]: ++worksListCopy[index].userRead.commentAmount
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
deleteVideo({
|
|
deleteVideo({
|
|
detail
|
|
detail
|