Vue.js
Vue.js
Phần tiêu đề “Vue.js”Vue là progressive framework để xây dựng user interfaces.
Basic Component
Phần tiêu đề “Basic Component”<template> <div class="counter"> <p>Count: {{ count }}</p> <button @click="increment">Increment</button> </div></template>
<script setup>import { ref } from "vue";
const count = ref(0);
function increment() { count.value++;}</script>
<style scoped>.counter { text-align: center;}</style>Reactivity
Phần tiêu đề “Reactivity”<script setup>import { ref, computed, watch } from "vue";
const count = ref(0);const doubled = computed(() => count.value * 2);
watch(count, (newValue, oldValue) => { console.log(`Count changed from ${oldValue} to ${newValue}`);});</script>Props & Emit
Phần tiêu đề “Props & Emit”<template> <button @click="handleClick">{{ label }}</button></template>
<script setup>const props = defineProps({ label: String,});
const emit = defineEmits(["click"]);
function handleClick() { emit("click");}</script>
<!-- Parent.vue --><template> <Child label="Click me" @click="handleEvent" /></template>Learn More
Phần tiêu đề “Learn More”- 👉 Vue Composables
- 📚 Vue Router
- 🎨 Pinia - State management