阴影
TuniaoUI 提供 4 级阴影体系,通过 getTnShadow() 函数获取标准化的阴影配置。
阴影预览

阴影分级
| 等级 | 属性名 | radius | offsetX | offsetY | 用途 |
|---|---|---|---|---|---|
| sm | shadowSm | 4 | 0 | 2 | 微小阴影(开关滑块、小按钮) |
| default | shadowDefault | 8 | 0 | 4 | 默认阴影(卡片、浮层) |
| md | shadowMd | 16 | 0 | 8 | 中等阴影(弹窗、下拉菜单) |
| lg | shadowLg | 24 | 0 | 12 | 大阴影(模态面板、底部弹出) |
使用方式
通过 getTnShadow(推荐)
typescript
import { getTnShadow } from "@tuniao/tn-ui/common/theme_helpers";
// 获取分级阴影
.shadow(getTnShadow(this.baseStyle, "sm"))
.shadow(getTnShadow(this.baseStyle, "default"))
.shadow(getTnShadow(this.baseStyle, "md"))
.shadow(getTnShadow(this.baseStyle, "lg"))手动构造
typescript
.shadow({
radius: this.baseStyle.shadowSm.radius,
color: $r("app.color.tn_shadow_light"),
offsetX: this.baseStyle.shadowSm.offsetX,
offsetY: this.baseStyle.shadowSm.offsetY,
})WARNING
禁止硬编码阴影参数,如 .shadow({ radius: 2, color: "rgba(0,0,0,0.15)", offsetY: 1 })。