1e41f4b71Sopenharmony_ci# label 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci> **说明:** 4e41f4b71Sopenharmony_ci> 从API version 4开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci为input、button、textarea组件定义相应的标注,点击该标注时会触发绑定组件的点击效果。 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci## 权限列表 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci无 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci## 子组件 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci不支持。 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci## 属性 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci除支持[通用属性](js-components-common-attributes.md)外,还支持如下属性: 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci| 名称 | 类型 | 默认值 | 必填 | 描述 | 23e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ---- | ----------- | 24e41f4b71Sopenharmony_ci| target | string | - | 否 | 目标组件的属性id值。 | 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci## 样式 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci除支持[通用样式](js-components-common-styles.md)外,还支持如下样式: 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci| 名称 | 类型 | 默认值 | 必填 | 描述 | 32e41f4b71Sopenharmony_ci| ----------------- | -------------------------- | ---------- | ---- | ---------------------------------------- | 33e41f4b71Sopenharmony_ci| color | <color> | #e5000000 | 否 | 设置文本的颜色。 | 34e41f4b71Sopenharmony_ci| font-size | <length> | 30px | 否 | 设置文本的尺寸。 | 35e41f4b71Sopenharmony_ci| allow-scale | boolean | true | 否 | 文本尺寸是否跟随系统设置字体缩放尺寸进行放大缩小。<br/>如果需要支持动态生效,请参看config描述文件中config-changes标签。 | 36e41f4b71Sopenharmony_ci| letter-spacing | <length> | 0px | 否 | 设置文本的字符间距。 | 37e41f4b71Sopenharmony_ci| font-style | string | normal | 否 | 设置文本的字体样式,可选值为:<br/>- normal:标准的字体样式;<br/>- italic:斜体的字体样式。 | 38e41f4b71Sopenharmony_ci| font-weight | number \| string | normal | 否 | 设置文本的字体粗细,number类型取值[100, 900],默认为400,取值越大,字体越粗。<br/>number取值必须为100的整数倍。<br/>string类型取值支持如下四个值:lighter、normal、bold、bolder。 | 39e41f4b71Sopenharmony_ci| text-decoration | string | none | 否 | 设置文本的文本修饰,可选值为:<br/>- underline:文字下划线修饰;<br/>- line-through:穿过文本的修饰线n<br/>- none:标准文本。 | 40e41f4b71Sopenharmony_ci| text-align | string | start<br/> | 否 | 设置文本的文本对齐方式,可选值为:<br/>- left:文本左对齐;<br/>- center:文本居中对齐;<br/>- right:文本右对齐;<br/>- start:根据文字书写相同的方向对齐;<br/>- end:根据文字书写相反的方向对齐。<br/>如文本宽度未指定大小,文本的宽度和父容器的宽度大小相等的情况下,对齐效果可能会不明显。 | 41e41f4b71Sopenharmony_ci| line-height | <length> | 0px | 否 | 设置文本的文本行高,设置为0px时,不限制文本行高,自适应字体大小。 | 42e41f4b71Sopenharmony_ci| text-overflow | string | clip | 否 | 在设置了最大行数的情况下生效,可选值为:<br/>- clip:将文本根据父容器大小进行裁剪显示;<br/>- ellipsis:根据父容器大小显示,显示不下的文本用省略号代替。需配合max-lines使用。 | 43e41f4b71Sopenharmony_ci| font-family | string | sans-serif | 否 | 设置文本的字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。 | 44e41f4b71Sopenharmony_ci| max-lines | number | - | 否 | 设置文本的最大行数。 | 45e41f4b71Sopenharmony_ci| min-font-size | <length> | - | 否 | 文本最小字号,需要和文本最大字号同时设置,支持文本字号动态变化。设置最大最小字体样式后,font-size不生效。 | 46e41f4b71Sopenharmony_ci| max-font-size | <length> | - | 否 | 文本最大字号,需要和文本最小字号同时设置,支持文本字号动态变化。设置最大最小字体样式后,font-size不生效。 | 47e41f4b71Sopenharmony_ci| font-size-step | <length> | 1px | 否 | 文本动态调整字号时的步长,需要设置最小,最大字号样式生效。 | 48e41f4b71Sopenharmony_ci| prefer-font-sizes | <array> | - | 否 | 预设的字号集合,在动态尺寸调整时,优先使用预设字号集合中的字号匹配设置的最大行数,如果预设字号集合未设置,则使用最大最小和步长调整字号。针对仍然无法满足最大行数要求的情况,使用text-overflow设置项进行截断,设置预设尺寸集后,font-size、max-font-size、min-font-size和font-size-step不生效。<br/>如:prefer-font-sizes: 12px,14px,16px | 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci## 事件 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci不支持。 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci## 方法 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci不支持。 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci## 示例 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci```html 64e41f4b71Sopenharmony_ci<!--xxx.hml --> 65e41f4b71Sopenharmony_ci<div class="container"> 66e41f4b71Sopenharmony_ci <div class="row"> 67e41f4b71Sopenharmony_ci <label class="label" target="textId">input</label> 68e41f4b71Sopenharmony_ci <input class="input" id="textId" type="text"></input> 69e41f4b71Sopenharmony_ci </div> 70e41f4b71Sopenharmony_ci <div class="row"> 71e41f4b71Sopenharmony_ci <label class="label" target="radioId">radio</label> 72e41f4b71Sopenharmony_ci <input class="input" id="radioId" type="radio" name="group" value="group"></input> 73e41f4b71Sopenharmony_ci </div> 74e41f4b71Sopenharmony_ci <div class="row"> 75e41f4b71Sopenharmony_ci <label class="label" target="checkboxId">checkbox</label> 76e41f4b71Sopenharmony_ci <input class="input" id="checkboxId" type="checkbox"></input> 77e41f4b71Sopenharmony_ci </div> 78e41f4b71Sopenharmony_ci</div> 79e41f4b71Sopenharmony_ci``` 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci```css 82e41f4b71Sopenharmony_ci/*xxx.css */ 83e41f4b71Sopenharmony_ci.container { 84e41f4b71Sopenharmony_ci flex-direction: column; 85e41f4b71Sopenharmony_ci margin-left: 20px; 86e41f4b71Sopenharmony_ci} 87e41f4b71Sopenharmony_ci.row { 88e41f4b71Sopenharmony_ci flex-direction: row; 89e41f4b71Sopenharmony_ci} 90e41f4b71Sopenharmony_ci.label { 91e41f4b71Sopenharmony_ci width: 200px; 92e41f4b71Sopenharmony_ci margin-top: 50px; 93e41f4b71Sopenharmony_ci} 94e41f4b71Sopenharmony_ci.input { 95e41f4b71Sopenharmony_ci margin-left: 100px; 96e41f4b71Sopenharmony_ci margin-top: 50px; 97e41f4b71Sopenharmony_ci} 98e41f4b71Sopenharmony_ci``` 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci 101