Dark mode
Vue Built-ins
Directives
Directives พื้นฐานของ Vue ที่ใช้ใน Template สำหรับการจัดการ DOM และการ bind ข้อมูล
Directive | Description | Category |
---|---|---|
v-text | กำหนดข้อความใน element | Basic |
v-html | แทรก HTML (ระวัง XSS) | Basic |
v-show | แสดง/ซ่อน element ด้วย CSS | Conditional |
v-if | แสดง element ตามเงื่อนไข | Conditional |
v-else | ใช้ร่วมกับ v-if | Conditional |
v-else-if | เงื่อนไขเพิ่มเติม | Conditional |
v-for | Loop ข้อมูล | List |
v-on | ฟังเหตุการณ์ (@ shorthand) | Event |
v-bind | ผูกข้อมูล (: shorthand) | Binding |
v-model | Two-way binding | Form |
v-slot | ตั้งชื่อ slot (# shorthand) | Slot |
v-pre | ไม่ compile template | Basic |
v-once | Render แค่ครั้งเดียว | Basic |
v-memo | Memoize template | Basic |
v-cloak | ซ่อน template จนกว่า Vue จะโหลดเสร็จ | Basic |
Components
Component พื้นฐานของ Vue สำหรับการจัดการ Transition, KeepAlive, และการทำงานกับ DOM
Component | Description | Category |
---|---|---|
<Transition> | ใช้สำหรับ animation/transition | Animation |
<KeepAlive> | เก็บ component ใน memory | State |
<Teleport> | ย้าย component ไปยัง DOM อื่น | DOM |
<Suspense> | จัดการ async component | Async |
Special Elements
Element | Description | Category |
---|---|---|
<component> | Dynamic component | Component |
<slot> | Content distribution | Slot |
<template> | Template fragment | Template |
Special Attributes
Attribute | Description | Category |
---|---|---|
key | ระบุตัวตนของ element | Rendering |
ref | อ้างอิงถึง element/component | Reference |
is | Dynamic component | Component |