To open this project, you can access this github webpage:
https://ull-esit-dmsi-1920.github.io/vue-fundamentals-alu0101227610/
Follow these steps:
- Write initial HTML with a shopping-list div
- Load and Instanciate Vue add data and Vue template syntax to interpolate
- Add an input an synchronize it with the interpolated text to see it
- Explore the app in the console
- Discuss the syntax of JS inside moustaches
- Learn to read the errors in the console
- Add items to data and show them using v-for
- Add input a variable to store the newItem
- Connect the input with the newItem and check the binding
- Use Vue Devtools. Configure it to work with file://
- Add v-on: Start by simulating in the console what we are going to do
- Add button to add the new item when clicked
- Add v-on:keyup.enter to the input element
- Shorthands for v-on
- Use a method
saveItem
to factorice - Reset the input when finished the insertion
- Check the method using the debugger
- v-if and v-else
- Add states: default and edition
- Add a
state
variable to the appdata
to represent the states of the app. - Move the
input
andbutton
Save Item elements to adiv
with classadd-item-form
so that these styles apply - Show the
div
with classadd-item-form
only if the state isedition
- To the div with class
header
add a buttonAdd Item
that will make the app transit from thedefault
state to theedition
state - Show the
add button
only if the state isdefault
- To the div with class
header
add a buttonCancel Adding Item
with the classbtn-cancel
that will make the app transit from theedition
state to thedefault
state - Show the
Cancel Adding Item
button only if the state isedition
- Add the
changeState
method that reflect the transitions between both states
- Using the dev tools, check that when we click the
save item
with theinput
empty we are adding new empty strings to theitems
list - Disable the button
save item
when theinput
is empty by binding thedisabled
attribute of the button
- Change the list of items from a list of Strings to a list of Objects with
label
andpurchased
attributes. Update thesaveItem
method and the template accordingly - Make use of the class
.strikeout
in the css file: to style the purchased items. See the Vue.js Guide section on Class and Style Bindings- Use first the object syntax
v-bind:class="{myclass: expression}"
and - later the array syntax
v-bind:class=[exp1, exp2]
- Use first the object syntax