控件:Label 文本标签

参数 类型 必填 说明 默认值
type string 控件类型,填写 Label -
text string 标题 -
size string 字体大小 "12"
align string 对齐方式,center - 居中,left - 左,right - 右 "left"
color string 字体颜色,格式:"255,255,255" "0,0,0"

script.json 文件内容:

需要创建 script.json 文件并将以下代码复制到创建的文件中

{
    "params": [{
        "type": "Label",
        "text": "图片",
        "size": 18,
        "align": "center",
        "color": "0,168,233"
        },{
        "type": "Image",
        "src": "https://www.touchsprite.com/wp-content/themes/tsweb/images/ts-images/ts_web_tsent_p1.png"           
        }]
}

注意事项

  1. script.json 文件中为脚本配置代码,lua文件中为调用脚本配置的代码
  2. script.json 及 main.lua 文件需要同时放到中控/云控 lua 文件夹下的脚本文件夹才会显示脚本配置
  3. 文件格式必须是 UTF-8,否则会显示乱码,推荐先复制到 lua 文件中,然后将文件和后缀修改为 script.json
  4. json 需要按照规范编写,不可以添加注释,否则会导致解析错误
  5. 当 json 中只有 label 时无法显示,需要和其他控件一起使用
  6. 如果想多个控件显示在一行,请点击查看具体教程。
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""