omi
omi copied to clipboard
omix 不同的 use path 下存在相同对象时,只会触发其中一个 path 的更新
比如,use: ['items', 'currentItem'],currentItem 包含在 items 里面。 page 在渲染时遍历 items,当 items 中的其他项的属性更新时,可以正常触发界面更新。但是当 items 中正好是 currentItem 的属性更新时,就只会触发 currentItem 的属性变动,不会触发 items[x] 的变动,界面就不会触发更新。
这个问题如何解决?感觉很容易遇到,从数据层面不好规避。
@dntzhang 这个 1 从哪来呢
@dntzhang 这个索引应该是 currentItem 在 items 里的索引对吧,但是这个索引只能在 onLoad 里从 options 里获取啊,这个 use 里写死一个固定的索引不行吧?
@huaoguo https://github.com/Tencent/omi/commit/85f53a74c6ed70b0527b6d467fff8ccc7fceb0be#diff-c2ea52a5eac5f360c38dd2f51bfe506aR42
但是我试了下,这行代码是可以触发更新的啊
@dntzhang 看看这个 https://github.com/huaoguo/omi/commit/f30ddf459b4deaebad54bd03d817d4f8265e0e37