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

71 lines
2.1 KiB
JavaScript
Raw Normal View History

2024-06-14 01:11:29 +00:00
"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
const _easycom_CaseBox2 = common_vendor.resolveComponent("CaseBox");
const _easycom_up_loadmore2 = common_vendor.resolveComponent("up-loadmore");
(_easycom_CaseBox2 + _easycom_up_loadmore2)();
}
const _easycom_CaseBox = () => "../../components/CaseBox/CaseBox.js";
const _easycom_up_loadmore = () => "../../node-modules/uview-plus/components/u-loadmore/u-loadmore.js";
2024-06-14 01:11:29 +00:00
if (!Math) {
(_easycom_CaseBox + _easycom_up_loadmore)();
2024-06-14 01:11:29 +00:00
}
const _sfc_main = {
__name: "news",
setup(__props) {
const caseList = common_vendor.ref([
{},
{},
{}
]);
const isLoading = common_vendor.ref(false);
const status = common_vendor.ref("more");
const loadMore = async () => {
console.log("加载更多...");
status.value = "loading";
if (isLoading.value)
return;
isLoading.value = true;
await fetchCases();
caseList.value.push({});
caseList.value.push({});
caseList.value.push({});
caseList.value.push({});
console.log("加载更多2...");
isLoading.value = false;
status.value = "nomore";
console.log("加载更多2...");
};
const fetchCases = () => {
return new Promise((resolve) => {
setTimeout(() => {
const newCases = [
{ id: 1, title: "Case 1" },
{ id: 2, title: "Case 2" }
];
resolve(newCases);
}, 1e3);
});
};
2024-06-14 01:11:29 +00:00
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(caseList.value, (item, index, i0) => {
2024-06-14 01:11:29 +00:00
return {
a: "4c8a5df1-0-" + i0,
b: index
2024-06-14 01:11:29 +00:00
};
}),
b: isLoading.value
}, isLoading.value ? {
c: common_vendor.p({
status: status.value
2024-06-14 01:11:29 +00:00
})
} : {}, {
d: common_vendor.o(loadMore)
});
2024-06-14 01:11:29 +00:00
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/uniapp1/gree_leran/pages/news/news.vue"]]);
2024-06-14 01:11:29 +00:00
wx.createPage(MiniProgramPage);