Compouted object
about
Use computed
after creating the calculation attribute, we can pass store.computedObjects
to manage store
all the computing properties, including synchronous calculation objects and asynchronous calculation objects.
pass store.computedObjects
you can access all the calculation objects,store.computedObjects
one Map
object.
illustrate besides
- The above created one
fullName
andfullName2
two calculation attributes store.computedObjects
oneMap
object, you can passstore.computedObjects.get("user.fullName")
to getfullName
calculating object, the object is oneComputedObject
example.ComputedObject
there is one instancerun
methods can manually execute the calculation function.- It can be passed for asynchronous calculations
store.computedObjects.get("user.fullName2").run()
come manually executing the calculation function, you can also passstore.state.user.fullName2.run()
manually execute the calculation function. - The synchronous calculation can only pass
store.computedObjects.get("user.fullName").run()
let's manually execute the calculation function. ComputedObject
there is one instancevalue
attributes, you can get the return value of the calculation function.ComputedObject
it is a class that checks more information for the API documentation.- By default, use a statement
computed
the state data path is used as the timeComputedObject
ofid
you can also passoptions.id
parameter to specifyid
as in the above examplefullName3
ofid=='myname'
.