index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
  2. import { use } from '../utils';
  3. import { emit, inherit } from '../utils/functional';
  4. import Cell from '../cell'; // Types
  5. var _use = use('contact-card'),
  6. sfc = _use[0],
  7. bem = _use[1],
  8. t = _use[2];
  9. function ContactCard(h, props, slots, ctx) {
  10. var type = props.type,
  11. editable = props.editable;
  12. return h(Cell, _mergeJSXProps([{
  13. "attrs": {
  14. "center": true,
  15. "border": false,
  16. "isLink": editable,
  17. "valueClass": bem('value'),
  18. "icon": type === 'edit' ? 'contact' : 'add-square'
  19. },
  20. "class": bem([type]),
  21. "on": {
  22. "click": function click(event) {
  23. if (editable) {
  24. emit(ctx, 'click', event);
  25. }
  26. }
  27. }
  28. }, inherit(ctx)]), [type === 'add' ? props.addText || t('addText') : [h("div", [t('name') + "\uFF1A" + props.name]), h("div", [t('tel') + "\uFF1A" + props.tel])]]);
  29. }
  30. ContactCard.props = {
  31. tel: String,
  32. name: String,
  33. addText: String,
  34. editable: {
  35. type: Boolean,
  36. "default": true
  37. },
  38. type: {
  39. type: String,
  40. "default": 'add'
  41. }
  42. };
  43. export default sfc(ContactCard);