Menu
CoddyTech

Recap: Component Cards

Part of the Fundamentals section of Coddy's Vue journey. Lesson 35 of 55.

challenge icon

Challenge

Medium

Create ShiftCard.vue with label and numeric places props. Render the label in an h2 and places followed by places in a paragraph. In #morning, pass Garden team and a parent ref starting at 6. Button #grow increments that ref and the child must follow. Reuse the child inside #evening with Kitchen team and a separate ref starting at 2. Button #later adds two evening places without changing morning places.

Add a third card inside #guest with label Guest team and no places prop. Give the child a numeric places default of 1, so it shows 1 places. This default card stays at one while the other two cards change.

Try it yourself

<!doctype html><html><head><meta charset="UTF-8"><title>Vue practice</title></head><body><div id="app"></div><script type="module" src="./main.js"></script></body></html>

All lessons in Fundamentals