feat: 字母描红页样式开发基本完成
This commit is contained in:
@@ -9,12 +9,21 @@ Component({
|
||||
properties: {
|
||||
primaryText: {
|
||||
type: String,
|
||||
value: '保存到作品库',
|
||||
value: '保存到相册',
|
||||
},
|
||||
primaryIcon: {
|
||||
type: String,
|
||||
value: 'download',
|
||||
},
|
||||
secondaryText: {
|
||||
type: String,
|
||||
value: '分享',
|
||||
},
|
||||
/** 须对应 iconfont 中 toy-icon-{name};历史上常用 wechat 已映射为 wechat-o */
|
||||
secondaryIcon: {
|
||||
type: String,
|
||||
value: 'line-share',
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
@@ -28,7 +37,31 @@ Component({
|
||||
value: 'share',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
/** 经归一化后的图标名,供 wxml 绑定(避免父级传 wechat 等 iconfont 中不存在的 name) */
|
||||
resolvedSecondaryIcon: 'line-share',
|
||||
},
|
||||
observers: {
|
||||
secondaryIcon() {
|
||||
this.syncSecondaryIconGlyph();
|
||||
},
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
this.syncSecondaryIconGlyph();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
syncSecondaryIconGlyph() {
|
||||
const raw = (this.data.secondaryIcon ?? '').trim();
|
||||
const aliases: Record<string, string> = {
|
||||
wechat: 'wechat-o',
|
||||
};
|
||||
const name = aliases[raw] || raw;
|
||||
this.setData({
|
||||
resolvedSecondaryIcon: name || 'line-share',
|
||||
});
|
||||
},
|
||||
onPrimaryTap() {
|
||||
if (this.data.disabled || this.data.loading) return;
|
||||
this.triggerEvent('primary');
|
||||
|
||||
Reference in New Issue
Block a user