1 Star 0 Fork 5.1K

youguilin / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
option.md 31.57 KB
一键复制 编辑 原始数据 按行查看 历史
mamingshuai 提交于 2021-06-02 01:00 . update OpenHarmony 2.0 Canary

option

When used as a child component of <select>, the <option> component is used to display items in the drop-down list.

When used as a child component of <menu>, the <option> component is used to display items in the displayed menu.

Permission List

None

Child Component

Not supported

Attribute

Name

Type

Default Value

Mandatory

Description

selected

boolean

-

No

Whether an option is the default option in the drop-down list. This attribute is available only when the parent component is <select>.

value

string

-

Yes

Value of an option, which is used as the returned value of the selected event of the <select>or <menu> parent component.

NOTE:

The option value to be displayed on the UI must be put between the start and end tags, for example, <option value="10">October</option>.

icon

string

-

No

Icon resource path. This icon is displayed before the option text. The supported icon formats are JPG, PNG, and SVG.

id

string

-

No

Unique ID of a component.

style

string

-

No

Style declaration of a component.

class

string

-

No

Style class of a component, which is used to refer to a style table.

disabled(Rich)5+

boolean

false

No

Whether this option is disabled. In this case, it cannot respond to user operations.

Event

Not supported

Style

The following style attributes are supported.

Name

Type

Default Value

Mandatory

Description

color

<color>

#e6000000

No

Text color of the options.

font-size

<length>

16px

No

Font size of the options.

allow-scale

boolean

true

No

Whether the font size changes with the system's font size settings.

NOTE:

If the config-changes tag of fontSize is configured for abilities in the config.json file, the setting takes effect without application restart.

font-weight

number | string

normal

No

Font weight. For details, see font-weight of the text component.

text-decoration

string

none

No

Text decoration. For details, see text-decoration of the text component.

font-family

string

sans-serif

No

Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the font specified by Custom Font Styles is used for the text.

1
https://gitee.com/yougl/docs.git
git@gitee.com:yougl/docs.git
yougl
docs
docs
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891