UNPKG

yanzhen-design-vue

Version:

75 lines (74 loc) 2.86 kB
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, withModifiers, createElementVNode, createVNode, toDisplayString, Fragment, createTextVNode, createCommentVNode, renderSlot } from "vue"; import { YzAvatar } from "../../../avatar/index.mjs"; import { contactsItemName, contactsItemProps, contactsItemEmits, contactsItemOptions } from "./contacts-item.mjs"; import { useContactsItem } from "./use-contacts-item.mjs"; const _sfc_main = /* @__PURE__ */ defineComponent({ ...{ name: contactsItemName, inheritAttrs: true }, __name: "contacts-item", props: contactsItemProps, emits: contactsItemEmits, setup(__props, { expose: __expose, emit: __emit }) { const { ns } = contactsItemOptions; const props = __props; const emit = __emit; const { ctx: { _ref, _avatar, _label, isSelf, _tags, errorImg }, methods: { handleClick, handleSuffixClick } } = useContactsItem(props, emit); __expose({ ref: _ref }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { ref_key: "_ref", ref: _ref, class: normalizeClass([unref(ns).b()]), onClick: _cache[1] || (_cache[1] = withModifiers( //@ts-ignore (...args) => unref(handleClick) && unref(handleClick)(...args), ["stop"] )) }, [ createElementVNode("div", { class: normalizeClass([unref(ns).e("avatar")]) }, [ createVNode(unref(YzAvatar), { size: 28, src: unref(_avatar), "err-src": unref(errorImg), text: unref(_label) }, null, 8, ["src", "err-src", "text"]) ], 2), createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [ createElementVNode("span", { class: normalizeClass([unref(ns).e("label")]) }, toDisplayString(unref(_label)), 3), createElementVNode("span", { class: normalizeClass([unref(ns).e("tags")]) }, [ unref(isSelf) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ createTextVNode("我自己") ], 64)) : unref(_tags) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [ createTextVNode(toDisplayString(unref(_tags)), 1) ], 64)) : createCommentVNode("", true) ], 2) ], 2), createElementVNode("div", { class: normalizeClass([unref(ns).e("suffix")]), onClick: _cache[0] || (_cache[0] = withModifiers( //@ts-ignore (...args) => unref(handleSuffixClick) && unref(handleSuffixClick)(...args), ["stop"] )) }, [ renderSlot(_ctx.$slots, "suffix") ], 2) ], 2); }; } }); export { _sfc_main as default };