"use strict"; const common_vendor = require("../../common/vendor.js"); if (!Array) { const _easycom_up_text2 = common_vendor.resolveComponent("up-text"); _easycom_up_text2(); } const _easycom_up_text = () => "../../node-modules/uview-plus/components/u-text/u-text.js"; if (!Math) { _easycom_up_text(); } const _sfc_main = { __name: "DiscussionsBox", props: { data: { type: Object, default: () => ({ id: 1, children: [], content: "内容", createTime: "2024-06-05T11:32:09.000+08:00", parentId: -1, userAvatar: null, userId: 1, userName: "123" }) } }, emits: ["clickHf"], setup(__props, { emit: __emit }) { const emit = __emit; const props = __props; common_vendor.ref([]); const isExpanded = common_vendor.ref(false); const displayedSubDiscussions = common_vendor.computed(() => { if (props.data.children == null) { props.data.children = []; } return isExpanded.value ? props.data.children : props.data.children.slice(0, 2); }); const toggleExpand = () => { isExpanded.value = !isExpanded.value; }; const handleReply = () => { emit("clickHf", props.data.id); }; return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.p({ text: "回复", type: "primary", size: "14" }), b: common_vendor.o(handleReply), c: props.data.userAvatar, d: common_vendor.p({ text: props.data.userName, type: "primary", bold: true, size: "17" }), e: common_vendor.p({ margin: "0 0 8px 0", text: props.data.content }), f: common_vendor.f(displayedSubDiscussions.value, (item, index, i0) => { return { a: "d78e81b4-3-" + i0, b: common_vendor.p({ text: item.userName + ":", type: "secondary", size: "15" }), c: "d78e81b4-4-" + i0, d: common_vendor.p({ text: item.content, size: "14" }), e: index }; }), g: props.data.children.length > 2 }, props.data.children.length > 2 ? { h: common_vendor.p({ text: isExpanded.value ? "收起" : "展开更多", type: "primary", size: "14" }), i: common_vendor.o(toggleExpand) } : {}); }; } }; const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d78e81b4"], ["__file", "D:/uniapp1/gree_leran/components/DiscussionsBox/DiscussionsBox.vue"]]); wx.createComponent(Component);