feat: 轮播组件优化

This commit is contained in:
duanshuwen
2025-07-14 17:02:21 +08:00
parent e5d908701f
commit 7f270dafe8
11 changed files with 227 additions and 31 deletions

View File

@@ -0,0 +1,57 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const _sfc_main = {
__name: "index",
setup(__props) {
const active = common_vendor.ref(0);
const thumbnails = common_vendor.ref([
{
url: "https://fastly.picsum.photos/id/866/654/400.jpg?hmac=z3vI4CYrpnXEgimSlJCDwXRxEa-UDHiRwzGEyB8V-po",
description: "瑶山古寨"
},
{
url: "https://fastly.picsum.photos/id/284/654/400.jpg?hmac=89XRCJxYTblKIFGLOp6hJ9U0GC8BQrcnJwE5pG21NAk",
description: "民俗表演"
},
{
url: "https://fastly.picsum.photos/id/281/654/400.jpg?hmac=hcAJB7y2Xz3DVuz6S4XeQZgzaTJ_QWnxtbnaagZL6Fs",
description: "特色美食"
},
{
url: "https://fastly.picsum.photos/id/435/654/400.jpg?hmac=TSVDxfo-zXbunxNQK0erSG_nmKcS20xfhbQsCAXLlHo",
description: "传统服饰"
},
{
url: "https://fastly.picsum.photos/id/737/654/400.jpg?hmac=VED05oEK3XB0Aa_DUVoZjTAf0bHjAmNYyJky4lq5vVo",
description: "其他"
}
]);
const handleThumbnailClick = (index) => {
active.value = index;
};
return (_ctx, _cache) => {
return {
a: common_vendor.f(thumbnails.value, (item, index, i0) => {
return {
a: item.url,
b: index
};
}),
b: active.value,
c: common_vendor.t(active.value + 1),
d: common_vendor.t(thumbnails.value.length),
e: common_vendor.f(thumbnails.value, (thumb, index, i0) => {
return {
a: thumb.url,
b: common_vendor.t(thumb.description),
c: index,
d: common_vendor.o(($event) => handleThumbnailClick(index), index)
};
})
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cc2009df"]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/components/ImageSwiper/index.js.map