const { iconName } = require('../../utils/icon-name'); // 头像组件:圆形 Lucide 图标头像(无二进制图片)。 // props: avatar(lucide 图标名 或 历史 emoji), size(rpx, 默认 120), bg(背景色) Component({ properties: { avatar: { type: String, value: 'user' }, size: { type: Number, value: 120 }, bg: { type: String, value: 'rgba(182,242,78,0.12)' } }, data: { glyph: 'user', iconSize: 60 }, observers: { avatar(v) { this.setData({ glyph: iconName(v, 'user') }); }, size(s) { this.setData({ iconSize: Math.round(s * 0.5) }); } }, lifetimes: { attached() { this.setData({ glyph: iconName(this.data.avatar, 'user'), iconSize: Math.round(this.data.size * 0.5) }); } } });