Answer the question
In order to leave comments, you need to log in
Where to store business logic?
I started learning vue immediately from a combat example, and not from hello world: I decided to write a cellular automaton simulator (the game "Life", for example). I do not understand one architectural moment.
Let's say the screen is divided into 2 parts: the top settings toolbar and the rest of the area - in fact, the canvas of the game itself (webgl three-js).
As a result, we have 3 components:
<App>
<Settings>
<Grid>
Answer the question
In order to leave comments, you need to log in
Create classes Cell.js, Game.jsexactly. Vue does not prevent you from writing your own classes.
It turns out that all the code and all the logic of the game should be in the Grid.vue file? Which will access Settings for parameters and actually render- if you need to make the components communicate with each other, then it is best to use vuex, in which you change the values from the Settings component, and Grid will look at these values from vuex and do something. Thus, you will take out the project settings and be able to cling them from anywhere in the application, otherwise you will have noodles
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question