openharmony 鸿蒙 js-service-widget-common-attributes

2025-06-12 浏览 (1)

Universal Attributes

NOTE

The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.

Common Attributes

Common attributes are used to set component identities and appearance.

NameTypeDefault ValueMandatoryDescription
idstring-NoUnique ID of the component.
stylestring-NoStyle declaration of the component.
classstring-NoStyle class of the component, which is used to refer to a style table.
refstring-NoReference information of child elements or child components, which is registered with the parent component on $refs.
disabledbooleanfalseNoWhether the component is disabled. If it is disabled, it cannot respond to user interactions.
dirstringautoNoComponent layout mode. Available values are as follows:
- rtl: right-to-left layout.
- ltr: left-to-right layout.
- auto: follows the system language environment.

Rendering Attributes

Rendering attributes are used to set whether a component is rendered.

NameTypeDefault ValueDescription
forArray-Expands the component based on the configured data list.
ifboolean-Whether the component is added or removed.
showboolean-Whether the component is displayed or hidden.

NOTE

Do not set styles in attribute fields.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙JavaScript Service Widget UI Components

harmony 鸿蒙Data Types

harmony 鸿蒙button

harmony 鸿蒙calendar

harmony 鸿蒙chart

harmony 鸿蒙clock

harmony 鸿蒙divider

harmony 鸿蒙image

harmony 鸿蒙input

harmony 鸿蒙progress

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