ui-js-building-ui-layout-text.md 1.5 KB
Newer Older
Z
zengyawen 已提交
1
# 添加标题行和文本区域
M
mamingshuai 已提交
2

Z
zengyawen 已提交
3
实现标题和文本区域最常用的是基础组件text。text组件用于展示文本,可以设置不同的属性和样式,文本内容需要写在标签内容区,完整属性和样式信息请参考[text](../reference/arkui-js/js-components-basic-text.md)。在页面中插入标题和文本区域的示例如下:
M
mamingshuai 已提交
4

Z
zengyawen 已提交
5

H
HelloCrease 已提交
6
```html
M
mamingshuai 已提交
7 8 9 10 11 12 13 14
<!-- xxx.hml -->
<div class="container">
  <text class="title-text">{{headTitle}}</text>
  <text class="paragraph-text">{{paragraphFirst}}</text>
  <text class="paragraph-text">{{paragraphSecond}}</text>
</div>
```

Z
zengyawen 已提交
15

H
HelloCrease 已提交
16
```css
M
mamingshuai 已提交
17 18 19 20 21 22 23 24 25 26 27
/* xxx.css */
.container {
  flex-direction: column;
  margin-top: 20px;
  margin-left: 30px;
}
.title-text {
  color: #1a1a1a;
  font-size: 50px;
  margin-top: 40px;
  margin-bottom: 20px;
W
wangshuainan 已提交
28
  font-weight: 700;
M
mamingshuai 已提交
29 30
}
.paragraph-text {
W
wangshuainan 已提交
31
  width: 95%;
M
mamingshuai 已提交
32 33 34 35 36 37
  color: #000000;
  font-size: 35px;
  line-height: 60px;
}
```

Z
zengyawen 已提交
38

H
HelloCrease 已提交
39
```js
M
mamingshuai 已提交
40 41 42
// xxx.js
export default {
  data: {
W
wangshuainan 已提交
43
    headTitle: 'Capture the Beauty in Moment',
M
mamingshuai 已提交
44 45 46 47 48
    paragraphFirst: 'Capture the beauty of light during the transition and fusion of ice and water. At the instant of movement and stillness, softness and rigidity, force and beauty, condensing moving moments.',
    paragraphSecond: 'Reflecting the purity of nature, the innovative design upgrades your visual entertainment and ergonomic comfort. Effortlessly capture what you see and let it speak for what you feel.',
  },
}
```
W
wangshuainan 已提交
49 50

 ![zh-cn_image_0000001118642600](figures/zh-cn_image_0000001118642600.PNG)