Learn Vue with Me EP.2 - เรื่อง Declarative Rendering
VueJS
ฟรี
#VueJS
#vue.js
#Vue
Declartive Rendering
เรื่อง Declarative Rendering
- ใช้
reactiveกับ object - ใช้
refกับค่า string, number
reactive
import { reactive } from 'vue'
const counter = reactive({ count: 0})
console.log(counter.count) // 0counter.count++ref
import { ref } from 'vue'
const message = ref('Hello World!')
console.log(message.value) // "Hello World!"message.value = 'Changed'Render
การ render หรือแสดงค่า variable ใน template ใช้ {{ }}
<h1>{{ message }}</h1><p>Count is: {{ counter.count }}</p>