gree_leran/unpackage/dist/dev/mp-weixin/pages/discuss/CommentItem.js

78 lines
2.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
const _component_CommentItem = common_vendor.resolveComponent("CommentItem");
(_easycom_up_button2 + _component_CommentItem)();
}
const _easycom_up_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
_easycom_up_button();
}
const _sfc_main = {
__name: "CommentItem",
props: {
comment: Object
},
emits: ["reply", "like", "share"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const toggleReplyForm = () => {
props.comment.showReplyForm = !props.comment.showReplyForm;
};
const likeComment = () => {
emit("like", props.comment.id);
};
const shareComment = () => {
emit("share", props.comment.id);
};
const handleReply = (commentId, replyText) => {
emit("reply", commentId, replyText);
};
const handleLike = (commentId) => {
emit("like", commentId);
};
const handleShare = (commentId) => {
emit("share", commentId);
};
return (_ctx, _cache) => {
return common_vendor.e({
a: __props.comment.avatar,
b: common_vendor.t(__props.comment.username),
c: common_vendor.t(__props.comment.text),
d: common_vendor.t(__props.comment.likes),
e: common_vendor.o(likeComment),
f: common_vendor.o(toggleReplyForm),
g: common_vendor.o(shareComment),
h: __props.comment.showReplyForm
}, __props.comment.showReplyForm ? {
i: _ctx.newComment,
j: common_vendor.o(($event) => _ctx.newComment = $event.detail.value),
k: common_vendor.o(_ctx.addComment),
l: common_vendor.p({
size: "large",
type: "primary",
shape: "circle",
text: "发表"
})
} : {}, {
m: common_vendor.f(__props.comment.replies, (reply, k0, i0) => {
return {
a: reply.id,
b: common_vendor.o(handleReply, reply.id),
c: common_vendor.o(handleLike, reply.id),
d: common_vendor.o(handleShare, reply.id),
e: "ed332cbd-1-" + i0,
f: common_vendor.p({
comment: reply
})
};
})
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ed332cbd"], ["__file", "D:/uniapp1/gree_leran/pages/discuss/CommentItem.vue"]]);
wx.createComponent(Component);