Vue API
本文暂时只包括兼容性表格,功能详情另见 Vue API。
全局 API兼容性
应用实例
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
app.component() | 5.0 | √ | √ | 10.0 | √ | x |
app.directive() | 5.0 | √ | x | 10.0 | √ | x |
app.use() | 5.0 | √ | x | 10.0 | √ | x |
app.mixin() | 5.0 | √ | x | 10.0 | √ | x |
app.provide() | 5.0 | √ | x | 10.0 | √ | x |
app.config | 5.0 | √ | √ | 10.0 | √ | x |
app.config.errorHandler | 5.0 | √ | x | 10.0 | √ | x |
app.config.warnHandler | 5.0 | √ | x | 10.0 | √ | x |
app.config.performance | 5.0 | √ | x | 10.0 | √ | x |
app.config.globalProperties | 5.0 | √ | x | 10.0 | √ | x |
app.config.optionMergeStrategies | 5.0 | √ | x | 10.0 | √ | x |
通用
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
nextTick() | 5.0 | x | √ | 10.0 | x | x |
defineComponent() | 5.0 | x | x | 10.0 | x | x |
defineAsyncComponent() | 5.0 | x | x | 10.0 | x | x |
响应式兼容性
响应式: 核心
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
ref() | 5.0 | √ | √ | 10.0 | √ | x |
computed() | 5.0 | √ | x | 10.0 | √ | x |
reactive() | 5.0 | √ | √ | 10.0 | √ | x |
readonly() | 5.0 | √ | x | 10.0 | √ | x |
watchEffect() | 5.0 | √ | x | 10.0 | √ | x |
watch() | 5.0 | √ | x | 10.0 | √ | x |
响应式: 工具
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
isRef() | 5.0 | √ | x | 10.0 | √ | x |
unref() | 5.0 | √ | x | 10.0 | √ | x |
toRef() | 5.0 | √ | x | 10.0 | √ | x |
toRefs() | 5.0 | √ | x | 10.0 | √ | x |
isProxy() | 5.0 | √ | x | 10.0 | √ | x |
isReactive() | 5.0 | √ | x | 10.0 | √ | x |
isReadonly() | 5.0 | √ | x | 10.0 | √ | x |
响应式: 进阶
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
shallowRef() | 5.0 | √ | x | 10.0 | √ | x |
triggerRef() | 5.0 | √ | x | 10.0 | √ | x |
customRef() | 5.0 | √ | x | 10.0 | √ | x |
shallowReactive() | 5.0 | √ | x | 10.0 | √ | x |
shallowReadonly() | 5.0 | √ | x | 10.0 | √ | x |
toRaw() | 5.0 | √ | x | 10.0 | √ | x |
markRaw() | 5.0 | √ | x | 10.0 | √ | x |
选项式 API兼容性
状态选项
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
data | 5.0 | √ | √ | 10.0 | √ | x |
props | 5.0 | √ | √ | 10.0 | √ | x |
computed | 5.0 | √ | √ | 10.0 | √ | x |
methods | 5.0 | √ | √ | 10.0 | √ | x |
watch | 5.0 | √ | √ | 10.0 | √ | x |
emits | 5.0 | √ | √ | 10.0 | √ | x |
渲染选项
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
template | 5.0 | x | x | 10.0 | x | x |
render | 5.0 | x | x | 10.0 | x | x |
生命周期选项
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
beforeCreate | 5.0 | √ | √ | 10.0 | √ | x |
created | 5.0 | √ | √ | 10.0 | √ | x |
beforeMount | 5.0 | √ | √ | 10.0 | √ | x |
mounted | 5.0 | √ | √ | 10.0 | √ | x |
beforeUpdate | 5.0 | √ | √ | 10.0 | √ | x |
updated | 5.0 | √ | √ | 10.0 | √ | x |
beforeUnmount | 5.0 | √ | √ | 10.0 | √ | x |
unmounted | 5.0 | √ | √ | 10.0 | √ | x |
errorCaptured | 5.0 | √ | x | 10.0 | √ | x |
renderTracked | 5.0 | √ | x | 10.0 | √ | x |
renderTriggered | 5.0 | √ | x | 10.0 | √ | x |
activated | 5.0 | √ | x | 10.0 | √ | x |
deactivated | 5.0 | √ | x | 10.0 | √ | x |
组合选项
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
provide | 5.0 | √ | x | 10.0 | √ | x |
inject | 5.0 | √ | x | 10.0 | √ | x |
mixins | 5.0 | √ | x | 10.0 | √ | x |
extends | 5.0 | √ | x | 10.0 | √ | x |
其他杂项
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
name | 5.0 | √ | √ | 10.0 | √ | x |
inheritAttrs | 5.0 | √ | √ | 10.0 | √ | x |
components | 5.0 | √ | √ | 10.0 | √ | x |
directives | 5.0 | √ | x | 10.0 | √ | x |
组件实例
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
$data | 5.0 | √ | √ | 10.0 | √ | x |
$props | 5.0 | √ | √ | 10.0 | √ | x |
$el | 5.0 | x | √ | 10.0 | x | x |
$options | 5.0 | √ | √ | 10.0 | √ | x |
$parent | 5.0 | √ | √ | 10.0 | √ | x |
$root | 5.0 | √ | √ | 10.0 | √ | x |
$slots | 5.0 | x | √ | 10.0 | √ | x |
$refs | 5.0 | √ | √ | 10.0 | √ | x |
$attrs | 5.0 | √ | √ | 10.0 | √ | x |
$watch() | 5.0 | √ | √ | 10.0 | √ | x |
$emit | 5.0 | √ | √ | 10.0 | √ | x |
$forceUpdate | 5.0 | √ | x | 10.0 | √ | x |
$nextTick | 5.0 | √ | √ | 10.0 | √ | x |
内置内容兼容性
指令
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
v-text | 5.0 | √ | √ | 10.0 | √ | x |
v-html | 5.0 | √ | x | 10.0 | √ | x |
v-show | 5.0 | √ | √ | 10.0 | √ | x |
v-if | 5.0 | √ | √ | 10.0 | √ | x |
v-else | 5.0 | √ | √ | 10.0 | √ | x |
v-else-if | 5.0 | √ | √ | 10.0 | √ | x |
v-for | 5.0 | √ | √ | 10.0 | √ | x |
v-on | 5.0 | √ | √ | 10.0 | √ | x |
v-bind | 5.0 | √ | √ | 10.0 | √ | x |
v-model | 5.0 | √ | √ | 10.0 | √ | x |
v-slot | 5.0 | √ | √ | 10.0 | √ | x |
v-pre | 5.0 | √ | x | 10.0 | √ | x |
v-once | 5.0 | √ | x | 10.0 | √ | x |
v-memo | 5.0 | x | x | 10.0 | x | x |
v-cloak | 5.0 | x | x | 10.0 | x | x |
组件
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
<Transition> | 5.0 | x | x | 10.0 | x | x |
<TransitionGroup> | 5.0 | x | x | 10.0 | x | x |
<KeepAlive> | 5.0 | x | x | 10.0 | x | x |
<Teleport> | 5.0 | x | x | 10.0 | x | x |
特殊元素
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
<component> | 5.0 | √ | x | 10.0 | √ | x |
<slot> | 5.0 | √ | √ | 10.0 | √ | x |
<template> | 5.0 | √ | √ | 10.0 | √ | x |
特殊 Attributes
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
key | 5.0 | √ | √ | 10.0 | √ | x |
ref | 5.0 | √ | √ | 10.0 | √ | x |
is | 5.0 | √ | x | 10.0 | √ | x |
进阶 API兼容性
渲染函数
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
h() | 5.0 | x | x | 10.0 | x | x |
resolveComponent() | 5.0 | x | √ | 10.0 | x | x |
resolveDirective() | 5.0 | x | x | 10.0 | x | x |
withDirectives() | 5.0 | x | √ | 10.0 | x | x |