可伴随页面下发时的 outspeech 中的内容屏幕同步滚动播报多行文本。
# demo
# props
名称 | 类型 | 默认值 | 可选值 | 必填 | 描述 |
---|---|---|---|---|---|
texts | Array(string)/Array(RowOption) | - | 是 | 需要展示文本列表,数组的每一项表示一行 | |
lineHeight | string | 76dp | - | 否 | 行高 |
fontSize | string | 48dp | - | 否 | 字体大小 |
# RowOption
参数 | 类型 | 默认值 | 可选值 | 必选 | 说明 |
---|---|---|---|---|---|
txt | string | - | - | 是 | 设置当前行需要展示的文本内容 |
start | number | - | - | 是 | 设置当前行的开始位置,对应tts中某个字符的下标,从0开始 |
# events
名称 | 参数 | 参数说明 | event说明 |
---|---|---|---|
onInterrupt | - | - | TTS播报被打断时触发 |
onEnd | - | - | TTS播报结束时触发 |
注:如果TTS播报停止时,可播报到最后一行,则触发end;否则触发interrupt。如果texts一共只有一行,则永远触发end事件。
# items
名称 | 说明 |
---|---|
header | 可以在组件顶部展示一个特殊内容,跟随整体一起滚动 |
footer | 在section组件内容的底部增加一个自定义内容 |
# 组件样例(example)
{
"type": "Section",
"componentId":"section_part",
"styles": {
"height":"400dp",
"width": "760dp",
"background": "rgba(255,25,1,0.2)",
"padding":"10dp",
"border-radius":"16dp",
"flex-direction":"column",
"justify-content":"space-between",
"align-items":"center"
},
"props": {
"fontSize": "51dp",
"lineHeight": "80dp",
"texts": [
{
"txt": "海客谈瀛洲,烟涛微茫信难求。",
"start": 0
},
{
"txt": "越人语天姥,云霞明灭或可睹。",
"start": 14
},
{
"txt": "天姥连天向天横,势拔五岳掩",
"start": 27
},
{
"txt": "赤城。天台四万八千丈,对此",
"start": 40
},
{
"txt": "欲倒东南倾。我欲因之梦吴越,",
"start": 54
},
{
"txt": "一夜飞度镜湖月。湖月照我影,",
"start": 68
},
{
"txt": "送我至剡溪。谢公宿处今尚在,",
"start": 82
},
{
"txt": "渌水荡漾清猿啼。脚著谢公屐,",
"start": 96
},
{
"txt": "身登青云梯。半壁见海日,空",
"start": 109
},
{
"txt": "中闻天鸡。千岩万转路不定,",
"start": 122
},
{
"txt": "迷花倚石忽已暝。熊咆龙吟殷",
"start": 135
},
{
"txt": "岩泉,栗深林兮惊层巅。云青",
"start": 148
},
{
"txt": "青兮欲雨,水澹澹兮生烟。列",
"start": 161
},
{
"txt": "缺霹雳,丘峦崩摧。洞天石扉,",
"start": 175
},
{
"txt": "訇然中开。青冥浩荡不见底,",
"start": 188
},
{
"txt": "日月照耀金银台。霓为衣兮风",
"start": 201
},
{
"txt": "为马,云之君兮纷纷而来下。",
"start": 214
},
{
"txt": "虎鼓瑟兮鸾回车,仙之人兮列",
"start": 227
},
{
"txt": "如麻。忽魂悸以魄动,恍惊起",
"start": 240
},
{
"txt": "而长嗟。惟觉时之枕席,失向",
"start": 253
},
{
"txt": "来之烟霞。世间行乐亦如此,",
"start": 266
},
{
"txt": "古来万事东流水。别君去兮何",
"start": 279
},
{
"txt": "时还?且放白鹿青崖间。须行",
"start": 292
},
{
"txt": "即骑访名山。安能摧眉折腰事",
"start": 305
},
{
"txt": "权贵,使我不得开心颜!",
"start": 318
}
]
},
"items":[
{
"type": "Image",
"componentId":"demo_image_id",
"styles": {
"height": "240dp",
"width": "240dp",
"scale-type": "centerCrop",
"border-radius": "10dp"
},
"props": {
"src": "https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=3964226855,2919916526&fm=58"
},
"slot": "header"
}
]
}