/** * @file item.js 列表组件每个具体项 * @author fuqiangqiang@baidu.com */ import Base from 'santd/base'; import {classCreator} from '../core/util'; import Avatar from '../avatar'; import type * as I from './interface'; const prefixCls = classCreator('list')(); export class Meta extends Base{ static components = { 's-avatar': Avatar } inited(): void { this.data.set('hasAvatar', !!(this.sourceSlots.named.avatar || this.data.get('avatar'))); this.data.set('hasTitle', !!(this.sourceSlots.named.title || this.data.get('title'))); this.data.set('hasDescription', !!(this.sourceSlots.named.description || this.data.get('description'))); } static template = `

` }; const actionsTemplate = ` `; export default class Item extends Base { static template = /* html */ `
`; static Meta = Meta; initData(): I.ItemState { return {} } inited(): void { this.data.set('hasExtra', !!this.sourceSlots.named.extra); } attached(): void { this.dispatch('santd_list_addItem', this); } }