example:
there are resource lists, builds, army lists, and other components in the game, all of which requireresource
variables.build reduces the number of
resource
values. How does this change spread to other components?
the current solution is to define a localStorage resource
, which is obtained by the highest-level component and passed to the low-level component, and then the low-level component uses created
to reconstruct data
(when the resource
attribute of the parent is added)
components. Although we try our best to maintain the original principle of inheriting
at most three levels, a page with more than a dozen components requires resource
. Adding a new variable requires more than a dozen pieces of the same code, and the degree of coupling scares me to death.
Libraries already used:
- the latest version of Vue2
- the latest version of Vue-Router