224 lines
5.9 KiB
JavaScript
224 lines
5.9 KiB
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("../../common/vendor.js");
|
||
|
if (!Array) {
|
||
|
const _easycom_up_text2 = common_vendor.resolveComponent("up-text");
|
||
|
const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
|
||
|
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
||
|
(_easycom_up_text2 + _easycom_up_avatar2 + _easycom_up_icon2)();
|
||
|
}
|
||
|
const _easycom_up_text = () => "../../node-modules/uview-plus/components/u-text/u-text.js";
|
||
|
const _easycom_up_avatar = () => "../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
|
||
|
const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
|
||
|
if (!Math) {
|
||
|
(_easycom_up_text + _easycom_up_avatar + _easycom_up_icon)();
|
||
|
}
|
||
|
const _sfc_main = {
|
||
|
__name: "CaseBox",
|
||
|
props: {
|
||
|
id: {
|
||
|
type: String,
|
||
|
default: ""
|
||
|
},
|
||
|
title: {
|
||
|
type: String,
|
||
|
default: "标题"
|
||
|
},
|
||
|
text: {
|
||
|
type: String,
|
||
|
default: "正文嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻徐"
|
||
|
},
|
||
|
data: {
|
||
|
type: String,
|
||
|
default: "日期"
|
||
|
},
|
||
|
cover: {
|
||
|
type: String,
|
||
|
default: "/static/image/imgerr.png"
|
||
|
},
|
||
|
userImage: {
|
||
|
type: String,
|
||
|
default: "地址"
|
||
|
},
|
||
|
userName: {
|
||
|
type: String,
|
||
|
default: "作者"
|
||
|
},
|
||
|
userId: {
|
||
|
type: String,
|
||
|
default: ""
|
||
|
},
|
||
|
isLike: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
},
|
||
|
likeNumber: {
|
||
|
type: Number,
|
||
|
default: 0
|
||
|
},
|
||
|
isComments: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
},
|
||
|
commentsNumber: {
|
||
|
type: Number,
|
||
|
default: 0
|
||
|
},
|
||
|
isCollection: {
|
||
|
type: Boolean,
|
||
|
default: false
|
||
|
},
|
||
|
collectionNumber: {
|
||
|
type: Number,
|
||
|
default: 0
|
||
|
}
|
||
|
},
|
||
|
setup(__props) {
|
||
|
const errorImg = () => {
|
||
|
info.cover = "/static/image/imgerr.png";
|
||
|
};
|
||
|
common_vendor.ref("name");
|
||
|
const props = __props;
|
||
|
const info = common_vendor.reactive({
|
||
|
id: "文章id",
|
||
|
title: "标题",
|
||
|
cover: "封面地址",
|
||
|
text: "正文嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻嘻徐",
|
||
|
data: "2024-11-11",
|
||
|
userImage: "",
|
||
|
userName: "作者",
|
||
|
userId: "作者id",
|
||
|
isLike: false,
|
||
|
likeNumber: 0,
|
||
|
isComments: false,
|
||
|
commentsNumber: 0,
|
||
|
isCollection: false,
|
||
|
collectionNumber: 0
|
||
|
});
|
||
|
const toLike = () => {
|
||
|
info.isLike = !info.isLike;
|
||
|
if (info.isLike) {
|
||
|
info.likeNumber++;
|
||
|
} else {
|
||
|
info.likeNumber--;
|
||
|
}
|
||
|
};
|
||
|
const toComments = () => {
|
||
|
info.isComments = !info.isComments;
|
||
|
if (info.isComments) {
|
||
|
info.commentsNumber++;
|
||
|
} else {
|
||
|
info.commentsNumber--;
|
||
|
}
|
||
|
};
|
||
|
const toCollection = () => {
|
||
|
info.isCollection = !info.isCollection;
|
||
|
if (info.isCollection) {
|
||
|
info.collectionNumber++;
|
||
|
} else {
|
||
|
info.collectionNumber--;
|
||
|
}
|
||
|
};
|
||
|
const ggg = () => {
|
||
|
info.id = props.id;
|
||
|
info.title = props.title;
|
||
|
info.cover = props.cover;
|
||
|
info.text = props.text;
|
||
|
info.userImage = props.userImage;
|
||
|
info.userName = props.userName;
|
||
|
info.userId = props.userId;
|
||
|
info.isLike = props.isLike;
|
||
|
info.likeNumber = props.likeNumber;
|
||
|
info.isComments = props.isComments;
|
||
|
info.commentsNumber = props.commentsNumber;
|
||
|
info.isCollection = props.isCollection;
|
||
|
info.collectionNumber = props.collectionNumber;
|
||
|
};
|
||
|
common_vendor.onMounted(() => {
|
||
|
ggg();
|
||
|
console.log("属性", props);
|
||
|
console.log("属性2", info);
|
||
|
});
|
||
|
return (_ctx, _cache) => {
|
||
|
return common_vendor.e({
|
||
|
a: info.cover,
|
||
|
b: common_vendor.o(errorImg),
|
||
|
c: common_vendor.p({
|
||
|
lines: 1,
|
||
|
text: info.title,
|
||
|
bold: "true",
|
||
|
size: "30rpx"
|
||
|
}),
|
||
|
d: common_vendor.p({
|
||
|
lines: 3,
|
||
|
text: info.text
|
||
|
}),
|
||
|
e: common_vendor.p({
|
||
|
lines: 1,
|
||
|
text: info.data,
|
||
|
bold: "true"
|
||
|
}),
|
||
|
f: common_vendor.p({
|
||
|
src: info.userImage
|
||
|
}),
|
||
|
g: common_vendor.p({
|
||
|
lines: 1,
|
||
|
text: info.userName
|
||
|
}),
|
||
|
h: info.isLike
|
||
|
}, info.isLike ? {
|
||
|
i: common_vendor.o(toLike),
|
||
|
j: common_vendor.p({
|
||
|
name: "heart-fill",
|
||
|
color: "#ff0004",
|
||
|
size: "28"
|
||
|
})
|
||
|
} : {
|
||
|
k: common_vendor.o(toLike),
|
||
|
l: common_vendor.p({
|
||
|
name: "heart",
|
||
|
color: "#ff0004",
|
||
|
size: "28"
|
||
|
})
|
||
|
}, {
|
||
|
m: common_vendor.t(info.likeNumber == 0 ? "" : info.likeNumber),
|
||
|
n: info.isComments
|
||
|
}, info.isComments ? {
|
||
|
o: common_vendor.o(toComments),
|
||
|
p: common_vendor.p({
|
||
|
name: "chat-fill",
|
||
|
color: "#ff0004",
|
||
|
size: "28"
|
||
|
})
|
||
|
} : {
|
||
|
q: common_vendor.o(toComments),
|
||
|
r: common_vendor.p({
|
||
|
name: "chat",
|
||
|
color: "#ff0004",
|
||
|
size: "28"
|
||
|
})
|
||
|
}, {
|
||
|
s: common_vendor.t(info.commentsNumber == 0 ? "" : info.commentsNumber),
|
||
|
t: info.isCollection
|
||
|
}, info.isCollection ? {
|
||
|
v: common_vendor.o(toCollection),
|
||
|
w: common_vendor.p({
|
||
|
name: "star-fill",
|
||
|
color: "#ff0004",
|
||
|
size: "28"
|
||
|
})
|
||
|
} : {
|
||
|
x: common_vendor.o(toCollection),
|
||
|
y: common_vendor.p({
|
||
|
name: "star",
|
||
|
color: "#ff0004",
|
||
|
size: "28"
|
||
|
})
|
||
|
}, {
|
||
|
z: common_vendor.t(info.collectionNumber == 0 ? "" : info.collectionNumber)
|
||
|
});
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/uniapp1/gree_leran/components/CaseBox/CaseBox.vue"]]);
|
||
|
wx.createComponent(Component);
|