This commit is contained in:
2025-04-05 23:47:00 +08:00
commit 8001f8eaeb
215 changed files with 14655 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
var t, e = require("../../@babel/runtime/helpers/defineProperty");
Component({
properties: {
banner: Array
},
lifetimes: {
attached: function() {
this.attachedIn();
}
},
attached: function() {
this.attachedIn();
},
data: (t = {
autoplay: !0
}, e(t, "autoplay", !0), e(t, "interval", 3e3), e(t, "duration", 500), e(t, "circular", !0),
e(t, "swiperHeight", 100), e(t, "swiperWidth", 300), e(t, "imgUrl", []), t),
observers: {
banner: function(t) {
0 == t.length && this.setData({
swiperHeight: 0
});
}
},
methods: {
attachedIn: function() {
var t = this, e = this.createSelectorQuery();
e.select(".swiper").boundingClientRect(), e.exec(function(e) {
t.setData({
swiperWidth: e[0].width
});
});
},
previewImg: function(t) {
var e = t.currentTarget.dataset.url;
if (e) return wx.navigateTo({
url: "/" + e
}), !1;
if (0 == this.data.imgUrl.length) {
var i = [];
this.properties.banner.map(function(t) {
i.push(t.image);
}), this.setData({
imgUrl: i
});
}
wx.previewImage({
current: this.data.imgUrl[this.data.current],
urls: this.data.imgUrl
});
},
load: function(t) {
this.setData({
swiperHeight: this.data.swiperWidth * t.detail.height / t.detail.width
});
}
}
});

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,7 @@
<view>
<swiper autoplay="{{autoplay}}" circular="{{circular}}" class="swiper" duration="{{duration}}" indicatorActiveColor="#4cadf1" indicatorColor="#eee" indicatorDots="true" interval="{{interval}}" style="height:{{swiperHeight}}px">
<swiper-item wx:for="{{banner}}" wx:key="{{ index }}">
<image bindload="load" bindtap="previewImg" class="slide-image" data-index="{{index}}" data-url="{{item.url}}" mode="widthFix" src="{{item.image}}"></image>
</swiper-item>
</swiper>
</view>

View File

@@ -0,0 +1,11 @@
.slide-image {
width: 100%;
}
.swiper {
margin:0 0 0;
}
image {
height: 20px;
}