about
according to AutoStore
of Basic principle, It has a built -in state change event system for monitoring State
the changes in the data in the state will trigger the corresponding event when the state data changes.
You can use it through listening events watch
to monitor State
data changes can execute the listener function when the monitored data occurs.
Provide three uses watch
how to:
- Call
store.watch
function, used to listen toState
data change. - Directly
State
statementwatch
function, and then write the return value of the listener to the statementwatch
the position where the function is located. - Called in the component
store.useWatch
function, used to listen tostore
the change of the object is automatically canceled when the component is destroyed.