Simple checking for updating of observe element
https://github.com/Tencent/omi/blob/master/packages/omi/src/observe.js#L14-L20
It should be noted that if observe
is used, do not set the value of data in some of the following functions: some complex objects such as obj or arr:
- render
- beforeRender
- beforeUpdate
- afterUpdate
Because data settings will simply compare the value before and after, complex objects will not be deep contrast, the contrast value will trigger different update, update will trigger the above function, infinite recursion.
But you set the property of data as a simple value type(string, number, bool ...)in those functions.