vue-lynx

欢迎来到 vue-lynx 的 API 参考,该包提供了用于构建 Lynx 应用的 Vue 3 框架。入门介绍请参阅快速开始指南。

Vue API

Vue Lynx 直接使用 Vue 3 的 @vue/runtime-core — 响应式系统、组件模型、生命周期钩子和组合式 API 都是标准的 Vue。你可以参考 Vue 3 官方文档来了解这些 API 的用法。

唯一的区别是你需要从 vue-lynx 而不是 vue 导入它们:

import { ref, computed, onMounted, defineComponent } from 'vue-lynx';

Vue Lynx API

以下 API 是 Vue Lynx 双线程架构(后台线程渲染器 + 主线程原生元素)特有的:

名称类型
MainThreadRefClass
createAppFunction
nextTickFunction
runOnBackgroundFunction
runOnMainThreadFunction
transformToWorkletFunction
useMainThreadRefFunction
VueLynxAppInterface

内置组件

组件状态备注
<Transition>实验性基于 CSS class 的进入/离开动画。需要显式的 :duration prop — 后台线程无法使用 getComputedStyle()
<TransitionGroup>实验性逐子元素进入/离开动画。不支持移动 (FLIP) 动画 — 后台线程无法使用 getBoundingClientRect()
<Suspense>支持从 Vue 重新导出。与 defineAsyncComponent() 配合使用。
<KeepAlive>不支持需要 Lynx 渲染器中不可用的元素回收功能。
<Teleport>不支持需要未实现的 querySelector 渲染器选项。
Warning

<Transition><TransitionGroup>实验性的。请始终传递显式的 :duration prop — 后台线程无法使用 getComputedStyle()<TransitionGroup> 不支持移动 (FLIP) 动画。

Vue 重新导出

vue-lynx 重新导出的标准 Vue 3 API。完整文档请参阅 Vue.js API 参考

名称类型
computedFunction
customRefFunction
defineAsyncComponentFunction
defineComponentFunction
defineEmitsFunction
defineExposeFunction
defineModelFunction
defineOptionsFunction
definePropsFunction
defineSlotsFunction
effectScopeFunction
getCurrentInstanceFunction
getCurrentScopeFunction
hFunction
hasInjectionContextFunction
injectFunction
isProxyFunction
isReactiveFunction
isReadonlyFunction
isRefFunction
isShallowFunction
markRawFunction
mergePropsFunction
onBeforeMountFunction
onBeforeUnmountFunction
onBeforeUpdateFunction
onErrorCapturedFunction
onMountedFunction
onRenderTrackedFunction
onRenderTriggeredFunction
onScopeDisposeFunction
onUnmountedFunction
onUpdatedFunction
onWatcherCleanupFunction
provideFunction
reactiveFunction
readonlyFunction
refFunction
shallowReactiveFunction
shallowReadonlyFunction
shallowRefFunction
toRawFunction
toRefFunction
toRefsFunction
toValueFunction
TransitionFunction
triggerRefFunction
unrefFunction
useAttrsFunction
useIdFunction
useModelFunction
useSlotsFunction
useTemplateRefFunction
watchFunction
watchEffectFunction
watchPostEffectFunction
watchSyncEffectFunction
withDefaultsFunction
AppInterface
ComponentTypeAlias
ComponentPublicInstanceTypeAlias
FragmentVariable
SuspenseVariable
TransitionGroupVariable
versionVariable
withAsyncContextVariable