27 lines
986 B
JavaScript
27 lines
986 B
JavaScript
/**
|
|||
|
|
* 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 });
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|