# 内容模块
内容模块以文本内容为主体,同时可以选择组合图片、按钮等交互组件,实现内容混排的效果。
模块标签为 div
, 可以单独通过 text
或 fields
来展示文本内容,也可以配合一个 image 元素或一个 button 等互动元素增加内容的丰富性。
在 消息卡片搭建工具 (opens new window) 中已经预置好了这些模块元素组合,你可以使用工具简化卡片搭建过程。
# 字段属性说明
参数 | 是否必须 | 类型 | 取值 | 说明 |
---|---|---|---|---|
tag | 是 | String | div | 模块标签,固定值div。 |
text | 是 | Struct | 参考: text | 单个文本展示,详情请参考text说明。与fields至少要有一个。 |
fields | 否 | Struct | 参考: fields | 多个文本展示,与text至少要有一个。 |
extra | 否 | Struct | 参考: button / img / list_selector | 附加的元素展示在文本内容右侧。可附加的元素包括 button , img 和 list_selector |
字段示例
- text 示例
{
"tag": "div",
"text": {
"tag": "plain_text",
"content": "Content module"
}
}
1
2
3
4
5
6
7
2
3
4
5
6
7
- fields 示例
{
"fields": [
{
"text": {
"tag": "plain_text",
"content": "text内容"
},
"is_short": false
},
{
"text": {
"tag": "plain_text",
"content": "text内容"
},
"needLayout": false
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- extra 示例
{
"extra": {
"text": {
"content": "按钮中展示的文本",
"tag": "plain_text"
},
"multiUrl": { // 多端跳转地址配置
"url": "https://hi.zhipin.com",
"pcUrl": "https://www.4399.com",
"androidUrl": "",
"iosUrl": ""
},
"callBacks": [
{
"key": "click1",
"value": "1"
}
],
"confirm": { // 点击之后,是否触发弹窗的配置
"title": {
"content": "弹窗标题",
"tag": "plain_text"
},
"text": {
"content": "弹窗内容",
"tag": "plain_text"
}
},
"type": "main",
"tag": "button"
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 内容模块样式图
# json 示例
{
"fields": [
{
"text": {
"content": "多文本1",
"tag": "plain_text"
},
"needLayout": true
},
{
"text": {
"content": "多文本2",
"tag": "plain_text"
},
"needLayout": true
},
{
"text": {
"content": "多文本3",
"tag": "plain_text"
},
"needLayout": true
},
{
"text": {
"content": "多文本4",
"tag": "plain_text"
},
"needLayout": true // 是否加入两列排列,false单独一行
}
],
"extra": {
"text": {
"content": "按钮中展示的文本",
"tag": "plain_text"
},
"multiUrl": {
"url": "https://hi.zhipin.com", // 兜底地址,当其他端地址未填时,使用此url
"pcUrl": "https://www.4399.com",
"androidUrl": "",
"iosUrl": ""
},
"callBacks": [ // 回调接口,发送的值,key-value形式
{
"key": "click1",
"value": "1"
}
],
"confirm": {
"title": {
"content": "弹窗标题",
"tag": "plain_text"
},
"text": {
"content": "弹窗内容",
"tag": "plain_text"
}
},
"type": "main", // 按钮的类型,枚举值:'primary' | 'default' | 'danger'
"tag": "button"
},
"tag": "div"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64