problem description
in business development, it is often encountered that certain values are related.
the environmental background of the problems and what methods you have tried
Environmental background
give the simplest example: a country-province-city 3-level linkage drop-down box (may not be appropriate, or can you expand to imagine a linkage you are familiar with?).
take another example of complexity: A-B-C-D has three values, and X-> Y means that when X changes, Y will change accordingly.
A-> B, A-> C, B-> C, D-> A
when one value changes, other values are triggered to change (you may also need to verify whether it is legal / not empty). It would be disgusting to write a method to deal with the linkage between them or to verify them.
try
so I was wondering if I could use Object.defineProperty to rewrite set () / get () methods in a project (the current project is done in Vue, and item in this.list cannot use computed due to restrictions on the usage of dependent components).
but it always feels like it"s too "corny" to do so. It is not elegant enough, but it is more troublesome to deal with the business relationship between these values by writing methods.
what result do you expect? What is the error message actually seen?
I would like to ask you how to deal with the situation of connectedness in this kind of business logic (a change in one value causes a change in other values).