Learn Vue with Me EP.6 - Computed Property
VueJS
ฟรี
#VueJS
#vue.js
#Vue
มาลองเรียน Vue.js กันผ่าน Vue.js Tutorial ของ Vue Official กันครับ จะเป็น text tutorial มี Text Editor และ Live Preview ให้เราลองเขียน ลองผลลัพธ์ได้ วันนี้ว่าด้วยเรื่องของ Computed property เอาไว้ช่วยให้เราไม่ต้องคำนวณค่าซ้ำๆ
อ่านเรื่อง computed property https://vuejs.org/guide/essentials/computed.html
Computed Property
import { ref, computed } from 'vue'
const hideCompleted = ref(false)const todos = ref([ /* ... */])
const filteredTodos = computed(() => { // return filtered todos based on // `todos.value` & `hideCompleted.value`})
<li v-for="todo in filteredTodos"></li>