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

44 lines
1.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
__name: "discuss",
setup(__props) {
const post = common_vendor.ref({
title: "这是一个讨论帖子",
content: "这是帖子的内容,大家可以在评论区讨论。"
});
const comments = common_vendor.ref([
{ id: 1, username: "Alice", text: "非常好的帖子!" },
{ id: 2, username: "Bob", text: "同意楼上的观点!" }
]);
const newComment = common_vendor.ref("");
const addComment = () => {
const newId = comments.value.length + 1;
comments.value.push({
id: newId,
username: "匿名用户",
text: this.newComment
});
newComment.value = "";
};
return (_ctx, _cache) => {
return {
a: common_vendor.t(post.value.title),
b: common_vendor.t(post.value.content),
c: common_vendor.f(comments.value, (comment, k0, i0) => {
return {
a: common_vendor.t(comment.username),
b: common_vendor.t(comment.text),
c: comment.id
};
}),
d: newComment.value,
e: common_vendor.o(($event) => newComment.value = $event.detail.value),
f: common_vendor.o(addComment)
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-9635802b"], ["__file", "E:/DAN/wexinxiaochengxude/NewCode2/gree_leran/pages/discuss/discuss.vue"]]);
wx.createPage(MiniProgramPage);