// 由父组件传来的值 model & onLineModelList
props: {
model: {
type: Object,
required: true
},
onLineModelList: {
type: Array,
required: true
}
},
// 监听 onLineModelList 如果发生变化则执行方法
watch: {
// 注意: function (newQuestion, oldQuestion) 这个形参是写死的
onLineModelList: function (newQuestion, oldQuestion) {
for (var a = 0; a < newQuestion.length; a++) {
if (this.model.imId !== null && this.model.imId !== '' && this.model.imId === newQuestion[a].imId) {
this.model.realUserCount = newQuestion[a].onLineUserCount
}
}
}
},
methods: {