// component/comment.js Component({ /** * 组件的属性列表 */ properties: { commentList: { type: Array, value: [], observer: function observer() { console.log(123) this.formatList() } } }, /** * 组件的初始数据 */ data: { inputValue: '', showControl: 0 }, /** * 组件的方法列表 */ methods: { formatList: function formatList(changeIndex) { this.data.commentList.map((item, index) => { if (changeIndex && index === changeIndex) { item.showControl = 100; } else { item.showControl = 0; } }) this.setData({ commentList: this.data.commentList }) console.log(321, this.data.commentList) }, showMore: function showMore(e) { // this.formatList(100) }, sendReply: function sendReply(e) { console.log('sendReply', e.detail.value) this.triggerEvent('sendReply', { content: e.detail.value }); this.setData({ inputValue: '', }) }, } })