Files
danyang-match/miniapp/components/empty/index.js
T

27 lines
986 B
JavaScript
Raw Normal View History

2026-09-09 22:05:00 +08:00
/**
* Empty 空状态(规范 §22 推荐为空时引导去 Discover / 申请红娘)
*
* 用法:
* <ui-empty title="暂时没有符合条件的人"
* description="可以去「找对象」看看更多符合条件的人"
* actions="{{[{text:'去「找对象', event:'discover'}, {text:'申请公益红娘', event:'matchmaker'}]}}"
* bind:action="onEmptyAction" />
*/
Component({
options: { addGlobalClass: true, multipleSlots: true },
properties: {
title: { type: String, value: '暂无内容' },
description: { type: String, value: '' },
// [{text, event, variant?: 'primary'|'secondary'}]
actions: { type: Array, value: [] },
// 图标变体(不依赖外部图片资源,纯 CSS 绘制)
illustration: { type: String, value: 'default' }, // default|search|heart|activity|message
},
methods: {
onAction(e) {
const { event } = e.currentTarget.dataset;
this.triggerEvent('action', { event });
},
},
});