Vue 3 API All In One


Vue 3 API All In One

Vue 3 API 汇总

https://vuejs.org/api/

Global API

Application

createApp()
createSSRApp()
app.mount()
app.unmount()
app.provide()
app.component()
app.directive()
app.use()
app.mixin()
app.version
app.config
app.config.errorHandler
app.config.warnHandler
app.config.performance
app.config.compilerOptions
app.config.globalProperties
app.config.optionMergeStrategies

General

version
nextTick()
defineComponent()
defineAsyncComponent()
defineCustomElement()

Composition API ?

setup() ??????

https://vuejs.org/api/composition-api-setup.html

Basic Usage
Accessing Props
Setup Context
Usage with Render Functions

Reactivity: Core

ref()
computed()
reactive()
readonly()
watchEffect()
watchPostEffect()
watchSyncEffect()
watch()

Reactivity: Utilities

isRef()
unref()
toRef()
toRefs()
isProxy()
isReactive()
isReadonly()

Reactivity: Advanced

shallowRef()
triggerRef()
customRef()
shallowReactive()
shallowReadonly()
toRaw()
markRaw()
effectScope()
getCurrentScope()
onScopeDispose()

Lifecycle Hooks

onMounted()
onUpdated()
onUnmounted()
onBeforeMount()
onBeforeUpdate()
onBeforeUnmount()
onErrorCaptured()
onRenderTracked()
onRenderTriggered()
onActivated()
onDeactivated()
onServerPrefetch()

Dependency Injection

provide()
inject()

Options API

Options: State

data
props
computed
methods
watch
emits
expose

Options: Rendering

template
render
compilerOptions

Options: Lifecycle

beforeCreate
created
beforeMount
mounted
beforeUpdate
updated
beforeUnmount
unmounted
errorCaptured
renderTracked
renderTriggered
activated
deactivated
serverPrefetch

Options: Composition

provide
inject
mixins
extends

Options: Misc

name
inheritAttrs
components
directives

Component Instance

$data
$props
$el
$options
$parent
$root
$slots
$refs
$attrs
$watch()
$emit()
$forceUpdate()
$nextTick()

Built-ins

Directives

v-text
v-html
v-show
v-if
v-else
v-else-if
v-for
v-on
v-bind
v-model
v-slot
v-pre
v-once
v-memo
v-cloak

Components





Special Elements


Special Attributes

key
ref
is

Single File Component ?

Syntax Specification

Overview
Language Blocks
Automatic Name Inference
Pre-Processors
Src Imports
Comments

先定义

先使用