import { PropType, defineComponent } from 'vue'; import { createNamespace } from '../utils'; import Cell from '../cell'; const [name, bem, t] = createNamespace('contact-card'); export type ContactCardType = 'add' | 'edit'; export default defineComponent({ name, props: { tel: String, name: String, addText: String, editable: { type: Boolean, default: true, }, type: { type: String as PropType, default: 'add', }, }, emits: ['click'], setup(props, { emit }) { const onClick = (event: MouseEvent) => { if (props.editable) { emit('click', event); } }; const renderContent = () => { if (props.type === 'add') { return props.addText || t('addText'); } return [
{`${t('name')}:${props.name}`}
,
{`${t('tel')}:${props.tel}`}
, ]; }; return () => ( {renderContent()} ); }, });