Answer the question
In order to leave comments, you need to log in
Where exactly lies the boundary between components (modules) and the application itself?
Hello.
There is a search form:
- There is a component - a list of search filters - checkboxes. They are defined by the schema in the JSON file;
- There is a component - a button by which the search is initiated;
- There is a component - the input field of the search query itself (but this is not quite about that).
{
"filters" : [{
"name" : {
"filter1" : "Header1"
},
"items" : {
"value1" : "Checkbox Name 1",
"value2" : "Checkbox Name 2",
"value3" : "Checkbox Name 3"
}
}, {
"name" : {
"filter2" : "Header2"
},
"items" : {
"value4" : "Checkbox Name 4"
}
}]
}
<form>
<filter>
<name>Header1</name>
<items>
<input type="checkbox" name="filter1" value="value1"> Checkbox Name 1
<input type="checkbox" name="filter1" value="value2"> Checkbox Name 2
<input type="checkbox" name="filter1" value="value3"> Checkbox Name 3
</items>
</filter>
<filter>
<name>Header2</name>
<items>
<input type="checkbox" name="filter2" value="value4"> Checkbox Name 4
</items>
</filter>
<!-- etc. -->
</form>
<button>Search</button>
{
filter1 : ["value1", "value3"], // checkbox с "value2" не выбран
filter2 : ["value4"]
}
Answer the question
In order to leave comments, you need to log in
It's probably worth first understanding what you call a component and what an application.
I would single out the following elements of the application:
1. Components - are responsible for how to display data
2. Services - are responsible for where to get / where to transfer / how to store data.
Based on this, if vuex is used:
1. Components interact with it, it is a data source. (I would also conditionally divide the components into those that interact with vuex and are completely encapsulated
) location.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question