ForEach(this.wallDatas, (item: RBUserModel) => {
RBVideoView({ userModel: item, volume:item.volumeValue, videoArea: RBWallType.wall, isSmallType: true})
.position({
x: (item.wallData?.pos_x ?? 0) * this.viewZoomScale,
y: (item.wallData?.pos_y ?? 0) * this.viewZoomScale
})
.width((item.wallData?.pos_width ?? 0) * this.viewZoomScale)
.height((item.wallData?.pos_height ?? 0) * this.viewZoomScale)
.zIndex(item.wallData?.zorder)
}, (item: RBUserModel) => item.uid)
如上,我使用forEach循环创建了几个videView。通过监听wallDatas的变化来更新view。
我在方法尾部添加了 (item: RBUserModel) =\> item.uid)做到了数组中model不变化的话,view不去做重新创建的操作。
但是这个导致一个问题是,我的model虽然没有变化,但是model上的视图位置信息变化了,但是view却不会跟着变化位置。 这种情况要如何处理。
对于多层嵌套的情况,比如二维数组,或者数组项class,或者class的属性是class,他们的第二层的属性变化是无法观察到的。需要使用@Observed/@ObjectLink装饰器。请确认修饰符使用是否正确。