← Code

Apps with Vue

Build pages that keep up with their data by themselves: data shown with {{ }}, lists with v-for, choices with v-if, events and inputs, computed values and components, ending in a to-do app. An optional last lesson builds the same app in Vue, Preact and Svelte.

Start1. Data on the page

Data on the page

Show data, make a tag for each item, show a tag only when it is needed, and change the data from clicks and typing.

1Data on the pageNot started
2Lists and choices: v-for and v-ifNot started

Make one tag for each item in a list with v-for, show a tag only when it is needed with v-if, and watch both keep up as the list changes.

  1. Predict
  2. Run
  3. Investigate › Trace the page
  4. Investigate › Which part does what?
  5. Investigate › Spot the bug
  6. Modify › Clear the list
  7. Modify › Team full
  8. A playlist
  9. Where this leads
Start lesson
3Events and inputsNot started

Building apps

Values worked out from data with computed, and components you make once and use many times.

4Values worked out from data: computedNot started

Work a value out from other data with computed, so it is worked out again whenever that data changes, and see why a plain calculation goes stale.

  1. Predict
  2. Run
  3. Investigate › Trace the page
  4. Investigate › Why computed?
  5. Investigate › Spot the bug
  6. Modify › Count the people
  7. Modify › A group deal
  8. A recipe scaler
  9. Where this leads
Start lesson
5Components and propsNot started

Final challenge: a to-do app

Build a to-do app in milestones. One optional lesson builds the same app in three frameworks.

6Final challenge: a to-do appNot started
7Same app, three frameworks OptionalNot started

The same small app in Vue, Preact (React's small cousin) and Svelte: state, worked-out values, events and showing data are the same ideas in all three; only the syntax and the update rules differ.

  1. Predict
  2. Run
  3. Investigate › Sort the ideas
  4. Investigate › Why no computed?
  5. Investigate › Spot the bug
  6. Modify › An if in Svelte
  7. Modify › Clear in Preact
  8. The same feature three times
  9. Where this leads
Start lesson

Progress is saved in this browser only. Nothing is sent anywhere.

For teachers: Teacher guide (notes, answers, solutions, slides and worksheets)