https://www.sitepoint.com/vue-3-beginner-guide/
Last updated 3 years ago
Was this helpful?
Chú ý: Sử dụng thuộc tính :key="task.id" cho vòng lặp như bên dưới.
<template> <ul> <h1>{{ title }}</h1> <ul> <li v-for="task in tasks" :key="task.id"> {{task.id}}. {{ task.name }} </li> </ul> </ul> </template> <script> export default { data() { return { title: 'My To Do App', tasks: [ { id: 1, name: 'Learn Vue JS', finished: false }, { id: 2, name: 'Build a Vue application', finished: false }, { id: 3, name: 'Write an article about Vue JS', finished: false } ] } } } </script>