openharmony 鸿蒙 arkts-decorator-overview

2026-08-25 浏览 (1)

UI Decorator Overview

The following table lists the common decorators in ArkUI.

Common DecoratorDescription
@RequireValidates constructor input parameters.
@BuilderCustomizes builder function.
@LocalBuilderMaintains the component relationship.
@BuilderParamReferences the @Builder function.
@StylesDefines the component reuse style.
@ExtendDefines the extension component style.
@AnimatableExtendDefines animatable attributes.
@EnvEnvironment variables.

The following table lists the V1 state management decorators in ArkUI.

V1 State Management DecoratorDescription
@StateBasic state variable.
@PropEstablishes one-way synchronization between the parent and child states.
@LinkEstablishes two-way synchronization between the parent and child states.
@ObjectLinkObserves the changes of nested class object attributes.
@ProvideEstablishes two-way synchronization with the child states.
@ConsumeEstablishes two-way synchronization with the ancestor state.
@WatchObserves state variable changes.
@StorageLinkEstablishes two-way data synchronization with the corresponding attribute in the AppStorage.
@StoragePropEstablishes two-way data synchronization with the corresponding attribute in the AppStorage.
@LocalStorageLinkEstablishes two-way data synchronization with the corresponding attribute in the LocalStorage.
@LocalStoragePropEstablishes one-way data synchronization with the corresponding attribute in the LocalStorage.
@ObservedMarks the class observable.
@TrackClass object attribute update.
@ReusableMarks the component reusable.

The following table lists the V2 state management decorators in ArkUI.

V2 State Management DecoratorDescription
@LocalInternal status of a component.
@ParamExternal input of the component.
@OnceSynchronizes initialization once.
@EventStandardizes the component output.
@ProviderEstablishes two-way synchronization with the child states.
@ConsumerEstablishes two-way synchronization with the ancestor states.
@MonitorObserves state variable changes.
@ComputedComputed attributes.
@ObservedV2Marks the class observable.
@TraceMarks the class attribute observable.
@TypeMarks the types of the class attributes.
@ReusableV2Marks the component reusable.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-new-makeObserved

openharmony 鸿蒙 arkts-new-param

openharmony 鸿蒙 arkts-state-management-introduce

openharmony 鸿蒙 properly-use-state-management-to-develope

openharmony 鸿蒙 arkts-new-persistencev2

openharmony 鸿蒙 arkts-v1-v2-migration-application

openharmony 鸿蒙 arkts-v1-v2-migration-reusable

openharmony 鸿蒙 arkts-page-custom-components-lifecycle

openharmony 鸿蒙 arkts-basic-syntax-overview

openharmony 鸿蒙 arkts-track

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/k4D5NujG