Files
tk-mini-program/unpackage/dist/dev/mp-weixin/TUIKit/components/TUIConversation/conversation-header/index.js
pengxiaolong c006a8e63d 消息
2025-05-13 19:39:53 +08:00

80 lines
2.8 KiB
JavaScript

"use strict";
const common_vendor = require("../../../../common/vendor.js");
require("../../../adapter-vue.js");
const TUIKit_components_TUIConversation_conversationHeader_server = require("./server.js");
if (!Math) {
Icon();
}
const Icon = () => "../../common/Icon.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "index",
setup(__props, { expose: __expose }) {
const showChildren = common_vendor.ref([]);
const convHeaderRef = common_vendor.ref();
const menuList = common_vendor.computed(() => {
return TUIKit_components_TUIConversation_conversationHeader_server.ConversationHeaderServer.getInstance().getMenu();
});
common_vendor.onMounted(() => {
showChildren.value = [];
});
const handleMenu = (item) => {
const { data: { children }, listener = { onClicked: () => {
} } } = item;
if (children) {
showChildren.value = showChildren.value.length > 0 ? [] : children;
} else {
listener.onClicked(item);
closeChildren();
}
};
const closeChildren = () => {
showChildren.value = [];
};
__expose({
closeChildren
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.unref(menuList).length > 0
}, common_vendor.unref(menuList).length > 0 ? {
b: common_vendor.f(common_vendor.unref(menuList), (item, index, i0) => {
return common_vendor.e({
a: item.icon && !item.data.children
}, item.icon && !item.data.children ? {
b: "c7a8f8e3-0-" + i0,
c: common_vendor.p({
file: item.icon
})
} : {}, {
d: common_vendor.t(item.text),
e: common_vendor.o$1(($event) => handleMenu(item), index),
f: index
});
})
} : {}, {
c: common_vendor.unref(showChildren).length > 0
}, common_vendor.unref(showChildren).length > 0 ? {
d: common_vendor.f(common_vendor.unref(showChildren), (childrenItem, childrenIndex, i0) => {
return common_vendor.e({
a: childrenItem.icon
}, childrenItem.icon ? {
b: "c7a8f8e3-1-" + i0,
c: common_vendor.p({
file: childrenItem.icon
})
} : {}, {
d: common_vendor.t(childrenItem.text),
e: common_vendor.o$1(($event) => handleMenu(childrenItem), childrenIndex),
f: childrenIndex
});
})
} : {}, {
e: common_vendor.unref(convHeaderRef)
});
};
}
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c7a8f8e3"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIConversation/conversation-header/index.js.map