ItemMeta.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { createVNode as _createVNode } from "vue";
  2. import { defineComponent } from 'vue';
  3. import useConfigInject from '../_util/hooks/useConfigInject';
  4. import PropTypes from '../_util/vue-types';
  5. export var listItemMetaProps = function listItemMetaProps() {
  6. return {
  7. avatar: PropTypes.any,
  8. description: PropTypes.any,
  9. prefixCls: String,
  10. title: PropTypes.any
  11. };
  12. };
  13. export default defineComponent({
  14. compatConfig: {
  15. MODE: 3
  16. },
  17. name: 'AListItemMeta',
  18. props: listItemMetaProps(),
  19. displayName: 'AListItemMeta',
  20. __ANT_LIST_ITEM_META: true,
  21. slots: ['avatar', 'description', 'title'],
  22. setup: function setup(props, _ref) {
  23. var slots = _ref.slots;
  24. var _useConfigInject = useConfigInject('list', props),
  25. prefixCls = _useConfigInject.prefixCls;
  26. return function () {
  27. var _props$title, _slots$title, _props$description, _slots$description, _props$avatar, _slots$avatar;
  28. var classString = "".concat(prefixCls.value, "-item-meta");
  29. var title = (_props$title = props.title) !== null && _props$title !== void 0 ? _props$title : (_slots$title = slots.title) === null || _slots$title === void 0 ? void 0 : _slots$title.call(slots);
  30. var description = (_props$description = props.description) !== null && _props$description !== void 0 ? _props$description : (_slots$description = slots.description) === null || _slots$description === void 0 ? void 0 : _slots$description.call(slots);
  31. var avatar = (_props$avatar = props.avatar) !== null && _props$avatar !== void 0 ? _props$avatar : (_slots$avatar = slots.avatar) === null || _slots$avatar === void 0 ? void 0 : _slots$avatar.call(slots);
  32. var content = _createVNode("div", {
  33. "class": "".concat(prefixCls.value, "-item-meta-content")
  34. }, [title && _createVNode("h4", {
  35. "class": "".concat(prefixCls.value, "-item-meta-title")
  36. }, [title]), description && _createVNode("div", {
  37. "class": "".concat(prefixCls.value, "-item-meta-description")
  38. }, [description])]);
  39. return _createVNode("div", {
  40. "class": classString
  41. }, [avatar && _createVNode("div", {
  42. "class": "".concat(prefixCls.value, "-item-meta-avatar")
  43. }, [avatar]), (title || description) && content]);
  44. };
  45. }
  46. });