| | |
| | | const app = Vue.createApp({ |
| | | data() { |
| | | return { goals: [] }; |
| | | return { |
| | | goals: [], |
| | | enteredGoal: '', |
| | | }; |
| | | |
| | | }, |
| | | methods: { |
| | | addGoal() { |
| | |
| | | <h2>My course goals</h2> |
| | | <input type="text" v-model="enteredGoal"/> |
| | | <button @click="addGoal">Add Goal</button> |
| | | <p v-if="goals.length === 0">No goals have been added yet - please start adding some!</p> |
| | | <p v-if="goals.length === 0"> |
| | | No goals have been added yet - please start adding some! |
| | | </p> |
| | | <ul v-else> |
| | | <li>Goal</li> |
| | | <li v-for="(goal, i) in goals">{{i}} - {{goal}}</li> |
| | | </ul> |
| | | <!-- <ul> |
| | | <li v-for="(value, key) in {nome: 'cristiano', cognome: 'magro'}">{{key}}: {{value}}</li> |
| | | </ul> --> |
| | | </section> |
| | | </body> |
| | | </html> |