@@ -150,6 +150,28 @@ Lifecycle hooks : { [beforeCreated], [created], [beforeMount], [mounted],
150150
151151---
152152
153+ ## Basics : Chapter 5 : Forms & Handling USER input
154+
155+ 1 . create a form
156+ 2 . create a label & textarea
157+ 3 . create a select & dynamic options -
158+ - <option :value =" option.value " v-for =" (option, index) in twootTypes " :key =" index " >
159+ - the v-for is looping a list of options named ` twootTyps `
160+ - the v-for requires a key - value pair
161+ - twootTypes doesn't have a dedicated key (ex. id) so we add the index of the array as key
162+ 4 . the [ v-model] attribute for handeling form data
163+ - v-model creates a sync link between de form input and a data component/variable/placeholder
164+ - in our ex. textarea is v-model with data-> newTwootContent
165+ 5 . the submit
166+ - normal submits refresh the html page, so to stop this we use ` prevent `
167+ - ` @submit.prevent="createNewTwoot" `
168+ - if we prevent, we have to replace it with something else ` createNewTwoot `
169+ - [ Mutation Methods] :
170+ - unshift => puts the item @ the top of the list = LIFO {last in, first out}
171+ - push => pust the item @ the back of the list LILO {last in, last out}
172+
173+ ---
174+
153175[ data ] : https://v3.vuejs.org/api/options-data.html#data-2
154176[ props ] : https://v3.vuejs.org/api/options-data.html#props
155177[ computed ] : https://v3.vuejs.org/api/options-data.html#computed
@@ -172,3 +194,5 @@ Lifecycle hooks : { [beforeCreated], [created], [beforeMount], [mounted],
172194[ conditionals ] : https://v3.vuejs.org/guide/conditional.html
173195[ v-if ] : https://v3.vuejs.org/guide/conditional.html#v-if
174196[ v-for ] : https://v3.vuejs.org/guide/list.html#mapping-an-array-to-elements-with-v-for
197+ [ v-model ] : https://v3.vuejs.org/api/directives.html#v-model
198+ [ mutation methods ] : https://v3.vuejs.org/guide/list.html#mutation-methods
0 commit comments