Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
4392ade2
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4392ade2
编写于
1月 12, 2023
作者:
E
ester.zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update docs (12201)
Signed-off-by:
N
ester.zhou
<
ester.zhou@huawei.com
>
上级
c8ff8fa5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
110 addition
and
1 deletion
+110
-1
en/application-dev/reference/arkui-js/figures/en-us-attributes.gif
...ation-dev/reference/arkui-js/figures/en-us-attributes.gif
+0
-0
en/application-dev/reference/arkui-js/figures/en-us_image1.png
...plication-dev/reference/arkui-js/figures/en-us_image1.png
+0
-0
en/application-dev/reference/arkui-js/js-components-common-attributes.md
...dev/reference/arkui-js/js-components-common-attributes.md
+110
-1
未找到文件。
en/application-dev/reference/arkui-js/figures/en-us-attributes.gif
0 → 100644
浏览文件 @
4392ade2
39.7 KB
en/application-dev/reference/arkui-js/figures/en-us_image1.png
0 → 100644
浏览文件 @
4392ade2
10.8 KB
en/application-dev/reference/arkui-js/js-components-common-attributes.md
浏览文件 @
4392ade2
...
@@ -31,5 +31,114 @@ Rendering attributes are used to set whether a component is rendered.
...
@@ -31,5 +31,114 @@ Rendering attributes are used to set whether a component is rendered.
| if | boolean | - | Whether the element is added or removed.|
| if | boolean | - | Whether the element is added or removed.|
| show | boolean | - | Whether the element is displayed or hidden.|
| show | boolean | - | Whether the element is displayed or hidden.|
> **NOTE**<br>
> **NOTE**
>
> Do not set styles in attribute fields.
> Do not set styles in attribute fields.
## Example
### Example 1
```
html
<!-- xxx.hml -->
<div
id=
"container"
>
<button
class=
"btn"
type=
"capsule"
value=
"toggleDisplay"
onclick=
"toggleDisplay"
></button>
<list
class=
"list"
>
<list-item
for=
"{{ array }}"
class=
"listItem"
>
<text
class=
"text"
onclick=
"toggleShow"
show=
"{{ visible }}"
if=
"{{ display }}"
>
{{ $item.value }}
</text>
</list-item>
</list>
</div>
```
```
css
/* xxx.css */
#container
{
flex-direction
:
column
;
width
:
100%
;
margin-top
:
10px
;
}
.text
{
font-size
:
50px
;
font-weight
:
500
;
margin-left
:
12px
;
}
.listItem
{
width
:
100%
;
height
:
100px
;
line-height
:
60px
;
border-bottom
:
1px
solid
#DEDEDE
;
font-size
:
20px
;
}
.btn
{
width
:
280px
;
font-size
:
26px
;
margin
:
10px
0
;
}
```
```
js
// xxx.js
export
default
{
data
:
{
visible
:
true
,
display
:
true
,
title
:
""
,
i
:
4
,
array
:
[
{
"
value
"
:
"
Item 0
"
},
{
"
value
"
:
"
Item 1
"
},
{
"
value
"
:
"
Item 2
"
},
{
"
value
"
:
"
Item 3
"
},
],
},
toggleShow
:
function
()
{
this
.
array
.
push
({
"
value
"
:
"
Item
"
+
this
.
i
})
this
.
i
++
},
toggleDisplay
:
function
()
{
this
.
display
=
!
this
.
display
},
}
```

### Example 2
```
html
<!-- xxx.hml -->
<div
class=
"container"
>
<div>
<text
class=
"text1"
dir=
'rtl'
>
hello world
</text>
</div>
<div>
<text
class=
"text2"
dir=
'ltr'
>
hello world
</text>
</div>
</div>
```
```
css
/* xxx.css */
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
width
:
100%
;
height
:
100%
;
}
.text1
{
width
:
90%
;
height
:
100px
;
background-color
:
aqua
;
}
.text2
{
width
:
90%
;
height
:
100px
;
background-color
:
blue
;
}
```

编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录