时钟 basic-timer
2026年7月20日大约 3 分钟
时钟 basic-timer
实时时间显示(日期 / 时分秒 / 星期),大屏顶栏常用。
- 类型串:
basic-timer默认尺寸:[320, 60]分类:时间
实时预览
下面渲染的是真实组件(与编辑器 / 运行时同源)。修改右侧「样式参数」,左侧预览实时更新;点击底部「全页面查看」可放大。
大屏顶栏常见形态:中文日期 + 时分秒 + 星期(
show-weekday),锁定北京时区time-zone: '+8',配字间距与发光让时间在深色底上更醒目。
属性
下表为本组件特有的属性;
position/size/opacity/background/border/ 联动选中 / 筛选等通用参数见组件手册总览。
basic
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
time-format | 时间格式 | string | YYYY-MM-DD HH:mm:ss | |
time-zone | 时区 | select | local | 可选:local / +8 / +9 / +0 / -5 / -8 |
show-weekday | 显示星期 | boolean | false |
font
| 属性 | 名称 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
text-font | 字体 | font(gradient=true,underline=true,line-through=true) | {"size":20,"color":"#ffffff"} | |
font-spacing | 字体间隔 | number(unit=px) | 0 | |
font-line-height | 行高 | number(unit=px,min=0) | 0 | |
text-indent | 文字缩进 | number(unit=px) | 0 | |
text-tilt | 文字倾斜 | vector<W,H>(unit=px) | [0,0] | |
text-position | 水平对齐方式 | select(radioGroup) | center | 可选:left / center / right |
text-vertical | 竖直对齐方式 | select(radioGroup) | center | 可选:top / center / bottom |
text-position-relative | 文本位置 | vector<X,Y>(unit=px) | [0,0] | |
font-shadow-color | 发光颜色 | color | #ffffff | |
font-shadow-blur | 发光模糊 | number(unit=px) | -1 | |
font-shadow-offset-x | 水平偏移 | number(unit=px) | 0 | |
font-shadow-offset-y | 垂直偏移 | number(unit=px) | 0 | |
shadow-color | 投影颜色 | color | #ffffff | |
shadow-blur | 投影模糊 | number(unit=px) | -1 | |
shadow-offset-x | 水平偏移 | number(unit=px) | 0 | |
shadow-offset-y | 垂直偏移 | number(unit=px) | 0 |
数据绑定
无组件特有数据绑定字段(纯样式 / 布局 / 装饰)。
事件
触发器
触发器在预览 / 播放态生效(编辑态点击 = 选中组件)。写在本组件
options.interactions的groups[].trigger里。
| 触发器 | 名称 | 触发时机 | payload(供动作公式 {:字段} 取值) |
|---|---|---|---|
click | 点击 | 点击本组件时触发 | 无 |
mouseEnter | 鼠标移入 | 指针移入组件时触发 | 无 |
mouseLeave | 鼠标移出 | 指针移出组件时触发 | 无 |
appear | 入场 | 组件出现时触发(配合进场动画) | 无 |
disappear | 离场 | 组件消失时触发(配合退场动画) | 无 |
receiveBehaviorEvent | 接收行为事件 | 收到 sendBehaviorEvent 动作或宿主 ctx.emit 投递的事件时触发(按 eventName 匹配) | 发送方携带的 data |
动作
触发器命中后执行的动作。本组件既可发起动作(配在自己的交互里),也可作为其它组件动作的目标。
| 动作 | 名称 | 说明 |
|---|---|---|
changeOption | 修改设置 | 把本组件(或其它组件)的某个属性改为静态值 / 公式动态值 |
switchState | 切换状态 | 切到多状态里的某个状态(state:"" 回默认态) |
appear / disappear | 进 / 退场动画 | 对目标 opacity 做 0↔100 插值的显隐动画 |
完整动作清单(switchScreen / switchWindow / openUrl / sendBehaviorEvent / transfer / executeScript / requestApi 等)与持久化写法见事件交互。
示例
{
"type": "basic-timer",
"uid": "w_basic_timer",
"options": {
"position": [40, 40],
"size": [320, 60]
}
}变体示例:只显时分秒的大字号挂钟
time-format: 'HH:mm:ss'去掉日期与星期,配 64px 粗体白字 + 投影,适合指挥大厅的巨幅挂钟位。