[improvement] rename packages dir to src (#3659)

This commit is contained in:
neverland
2019-06-27 11:25:57 +08:00
committed by GitHub
parent 8489918dca
commit 75c79b7044
619 changed files with 21 additions and 21 deletions
+68
View File
@@ -0,0 +1,68 @@
import { createNamespace } from '../utils';
import { emit, inherit } from '../utils/functional';
import Cell from '../cell';
// Types
import { CreateElement, RenderContext } from 'vue/types';
import { DefaultSlots } from '../utils/types';
const [createComponent, bem, t] = createNamespace('contact-card');
export type ContactCardProps = {
tel?: string;
name?: string;
type?: string;
addText: string;
editable: boolean;
};
function ContactCard(
h: CreateElement,
props: ContactCardProps,
slots: DefaultSlots,
ctx: RenderContext<ContactCardProps>
) {
const { type, editable } = props;
function onClick(event: Event) {
if (editable) {
emit(ctx, 'click', event);
}
}
return (
<Cell
center
border={false}
isLink={editable}
class={bem([type])}
valueClass={bem('value')}
icon={type === 'edit' ? 'contact' : 'add-square'}
onClick={onClick}
{...inherit(ctx)}
>
{type === 'add'
? props.addText || t('addText')
: [
<div>{`${t('name')}${props.name}`}</div>,
<div>{`${t('tel')}${props.tel}`}</div>
]}
</Cell>
);
}
ContactCard.props = {
tel: String,
name: String,
addText: String,
editable: {
type: Boolean,
default: true
},
type: {
type: String,
default: 'add'
}
};
export default createComponent<ContactCardProps>(ContactCard);