feat: 轮播组件优化
This commit is contained in:
57
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.js
vendored
Normal file
57
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.js
vendored
Normal 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
|
||||
4
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="image-swiper data-v-cc2009df"><swiper class="swiper-box data-v-cc2009df" autoplay="{{false}}" interval="{{3000}}" duration="{{1000}}" current="{{b}}"><swiper-item wx:for="{{a}}" wx:for-item="item" wx:key="b" class="swiper-item data-v-cc2009df"><image class="data-v-cc2009df" src="{{item.a}}" mode="aspectFill"></image></swiper-item></swiper><view class="custom-indicator data-v-cc2009df"> 图片{{c}}/{{d}}</view><view class="thumbnail-box data-v-cc2009df"><view wx:for="{{e}}" wx:for-item="thumb" wx:key="c" class="thumbnail-item data-v-cc2009df" bindtap="{{thumb.d}}"><image class="data-v-cc2009df" src="{{thumb.a}}" mode="aspectFill"></image><text class="data-v-cc2009df">{{thumb.b}}</text></view></view></view>
|
||||
71
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.wxss
vendored
Normal file
71
unpackage/dist/dev/mp-weixin/components/ImageSwiper/index.wxss
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.image-swiper.data-v-cc2009df {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
.swiper-box.data-v-cc2009df {
|
||||
border-radius: 8px;
|
||||
height: 200px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.swiper-item image.data-v-cc2009df {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.custom-indicator.data-v-cc2009df {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
z-index: 10;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
border-radius: 50px;
|
||||
padding: 3px 8px;
|
||||
font-size: 8px;
|
||||
color: #fff;
|
||||
}
|
||||
.thumbnail-box.data-v-cc2009df {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
right: 12px;
|
||||
bottom: 36px;
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
}
|
||||
.thumbnail-item.data-v-cc2009df {
|
||||
text-align: center;
|
||||
}
|
||||
.thumbnail-item image.data-v-cc2009df {
|
||||
width: 48px;
|
||||
height: 38px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
.thumbnail-item text.data-v-cc2009df {
|
||||
color: #fff;
|
||||
font-size: 8px;
|
||||
display: block;
|
||||
}
|
||||
Reference in New Issue
Block a user