first commit
This commit is contained in:
128
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/props.js
vendored
Normal file
128
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/props.js
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 列表数组,元素可为字符串,如为对象可通过keyName指定目标属性名
|
||||
list: {
|
||||
type: Array,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.list
|
||||
},
|
||||
// 是否显示面板指示器
|
||||
indicator: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.indicator
|
||||
},
|
||||
// 指示器非激活颜色
|
||||
indicatorActiveColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.indicatorActiveColor
|
||||
},
|
||||
// 指示器的激活颜色
|
||||
indicatorInactiveColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.indicatorInactiveColor
|
||||
},
|
||||
// 指示器样式,可通过bottom,left,right进行定位
|
||||
indicatorStyle: {
|
||||
type: [String, Object],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.indicatorStyle
|
||||
},
|
||||
// 指示器模式,line-线型,dot-点型
|
||||
indicatorMode: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.indicatorMode
|
||||
},
|
||||
// 是否自动切换
|
||||
autoplay: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.autoplay
|
||||
},
|
||||
// 当前所在滑块的 index
|
||||
current: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.current
|
||||
},
|
||||
// 当前所在滑块的 item-id ,不能与 current 被同时指定
|
||||
currentItemId: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.currentItemId
|
||||
},
|
||||
// 滑块自动切换时间间隔
|
||||
interval: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.interval
|
||||
},
|
||||
// 滑块切换过程所需时间
|
||||
duration: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.duration
|
||||
},
|
||||
// 播放到末尾后是否重新回到开头
|
||||
circular: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.circular
|
||||
},
|
||||
// 前边距,可用于露出前一项的一小部分,nvue和支付宝不支持
|
||||
previousMargin: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.previousMargin
|
||||
},
|
||||
// 后边距,可用于露出后一项的一小部分,nvue和支付宝不支持
|
||||
nextMargin: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.nextMargin
|
||||
},
|
||||
// 当开启时,会根据滑动速度,连续滑动多屏,支付宝不支持
|
||||
acceleration: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.acceleration
|
||||
},
|
||||
// 同时显示的滑块数量,nvue、支付宝小程序不支持
|
||||
displayMultipleItems: {
|
||||
type: Number,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.displayMultipleItems
|
||||
},
|
||||
// 指定swiper切换缓动动画类型,有效值:default、linear、easeInCubic、easeOutCubic、easeInOutCubic
|
||||
// 只对微信小程序有效
|
||||
easingFunction: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.easingFunction
|
||||
},
|
||||
// list数组中指定对象的目标属性名
|
||||
keyName: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.keyName
|
||||
},
|
||||
// 图片的裁剪模式
|
||||
imgMode: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.imgMode
|
||||
},
|
||||
// 组件高度
|
||||
height: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.height
|
||||
},
|
||||
// 背景颜色
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.bgColor
|
||||
},
|
||||
// 组件圆角,数值或带单位的字符串
|
||||
radius: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.radius
|
||||
},
|
||||
// 是否加载中
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.loading
|
||||
},
|
||||
// 是否显示标题,要求数组对象中有title属性
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.swiper.showTitle
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
62
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.acss
vendored
Normal file
62
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.acss
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
.u-empty.data-v-4e7d0c90,
|
||||
.u-empty__wrap.data-v-4e7d0c90,
|
||||
.u-tabs.data-v-4e7d0c90,
|
||||
.u-tabs__wrapper.data-v-4e7d0c90,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-4e7d0c90,
|
||||
.u-tabs__wrapper__scroll-view.data-v-4e7d0c90,
|
||||
.u-tabs__wrapper__nav.data-v-4e7d0c90,
|
||||
.u-tabs__wrapper__nav__line.data-v-4e7d0c90 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-swiper__wrapper.data-v-4e7d0c90 {
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper.data-v-4e7d0c90 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.u-swiper__wrapper.data-v-4e7d0c90 {
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper__wrapper__item.data-v-4e7d0c90 {
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper__wrapper__item__wrapper.data-v-4e7d0c90 {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: transform 0.3s;
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper__wrapper__item__wrapper__image.data-v-4e7d0c90 {
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper__wrapper__item__wrapper__video.data-v-4e7d0c90 {
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper__wrapper__item__wrapper__title.data-v-4e7d0c90 {
|
||||
position: absolute;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
font-size: 28rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
color: #FFFFFF;
|
||||
flex: 1;
|
||||
}
|
||||
.u-swiper__indicator.data-v-4e7d0c90 {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
}
|
||||
1
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.axml
vendored
Normal file
1
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.axml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="u-swiper data-v-4e7d0c90" style="{{'background-color:' + t + ';' + ('height:' + v) + ';' + ('border-radius:' + w)}}"><view a:if="{{a}}" class="u-swiper__loading data-v-4e7d0c90"><u-loading-icon class="data-v-4e7d0c90" u-i="4e7d0c90-0" onVI="__l" u-p="{{b}}"></u-loading-icon></view><swiper a:else class="u-swiper__wrapper data-v-4e7d0c90" style="{{'flex:' + '1' + ';' + ('height:' + d)}}" onChange="{{e}}" circular="{{f}}" interval="{{g}}" duration="{{h}}" autoplay="{{i}}" current="{{j}}" currentItemId="{{k}}" previousMargin="{{l}}" nextMargin="{{m}}" acceleration="{{n}}" displayMultipleItems="{{o}}" easingFunction="{{p}}"><swiper-item a:for="{{c}}" a:for-item="item" a:key="q" class="u-swiper__wrapper__item data-v-4e7d0c90"><view class="u-swiper__wrapper__item__wrapper data-v-4e7d0c90" style="{{item.p}}"><image a:if="{{item.a}}" class="u-swiper__wrapper__item__wrapper__image data-v-4e7d0c90" src="{{item.b}}" mode="{{item.c}}" onTap="{{item.d}}" style="{{'height:' + item.e + ';' + ('border-radius:' + item.f)}}"></image><video a:if="{{item.g}}" class="u-swiper__wrapper__item__wrapper__video data-v-4e7d0c90" id="{{item.h}}" enable-progress-gesture="{{false}}" src="{{item.i}}" poster="{{item.j}}" title="{{item.k}}" style="{{'height:' + item.l}}" controls onTap="{{item.m}}"></video><text a:if="{{item.n}}" class="u-swiper__wrapper__item__wrapper__title u-line-1 data-v-4e7d0c90">{{item.o}}</text></view></swiper-item></swiper><view class="u-swiper__indicator data-v-4e7d0c90" style="{{s}}"><slot name="indicator"><u-swiper-indicator a:if="{{q}}" class="data-v-4e7d0c90" u-i="4e7d0c90-1" onVI="__l" u-p="{{r}}"></u-swiper-indicator></slot></view></view>
|
||||
168
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.js
vendored
Normal file
168
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.js
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_uviewPlus_components_uSwiper_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const uni_modules_uviewPlus_libs_function_test = require("../../libs/function/test.js");
|
||||
const _sfc_main = {
|
||||
name: "u-swiper",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uSwiper_props.props],
|
||||
data() {
|
||||
return {
|
||||
currentIndex: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
current(val, preVal) {
|
||||
if (val === preVal)
|
||||
return;
|
||||
this.currentIndex = val;
|
||||
}
|
||||
},
|
||||
emits: ["click", "change"],
|
||||
computed: {
|
||||
itemStyle() {
|
||||
return (index) => {
|
||||
const style = {};
|
||||
if (this.nextMargin && this.previousMargin) {
|
||||
style.borderRadius = uni_modules_uviewPlus_libs_function_index.addUnit(this.radius);
|
||||
if (index !== this.currentIndex)
|
||||
style.transform = "scale(0.92)";
|
||||
}
|
||||
return style;
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addStyle: uni_modules_uviewPlus_libs_function_index.addStyle,
|
||||
addUnit: uni_modules_uviewPlus_libs_function_index.addUnit,
|
||||
testObject: uni_modules_uviewPlus_libs_function_test.test.object,
|
||||
testImage: uni_modules_uviewPlus_libs_function_test.test.image,
|
||||
getItemType(item) {
|
||||
if (typeof item === "string")
|
||||
return uni_modules_uviewPlus_libs_function_test.test.video(this.getSource(item)) ? "video" : "image";
|
||||
if (typeof item === "object" && this.keyName) {
|
||||
if (!item.type)
|
||||
return uni_modules_uviewPlus_libs_function_test.test.video(this.getSource(item)) ? "video" : "image";
|
||||
if (item.type === "image")
|
||||
return "image";
|
||||
if (item.type === "video")
|
||||
return "video";
|
||||
return "image";
|
||||
}
|
||||
},
|
||||
// 获取目标路径,可能数组中为字符串,对象的形式,额外可指定对象的目标属性名keyName
|
||||
getSource(item) {
|
||||
if (typeof item === "string")
|
||||
return item;
|
||||
if (typeof item === "object" && this.keyName)
|
||||
return item[this.keyName];
|
||||
else
|
||||
uni_modules_uviewPlus_libs_function_index.error("请按格式传递列表参数");
|
||||
return "";
|
||||
},
|
||||
// 轮播切换事件
|
||||
change(e) {
|
||||
const {
|
||||
current
|
||||
} = e.detail;
|
||||
this.pauseVideo(this.currentIndex);
|
||||
this.currentIndex = current;
|
||||
this.$emit("change", e.detail);
|
||||
},
|
||||
// 切换轮播时,暂停视频播放
|
||||
pauseVideo(index) {
|
||||
const lastItem = this.getSource(this.list[index]);
|
||||
if (uni_modules_uviewPlus_libs_function_test.test.video(lastItem)) {
|
||||
const video = common_vendor.index.createVideoContext(`video-${index}`, this);
|
||||
video.pause();
|
||||
}
|
||||
},
|
||||
// 当一个轮播item为视频时,获取它的视频海报
|
||||
getPoster(item) {
|
||||
return typeof item === "object" && item.poster ? item.poster : "";
|
||||
},
|
||||
// 点击某个item
|
||||
clickHandler(index) {
|
||||
this.$emit("click", index);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_u_loading_icon2 = common_vendor.resolveComponent("u-loading-icon");
|
||||
const _easycom_u_swiper_indicator2 = common_vendor.resolveComponent("u-swiper-indicator");
|
||||
(_easycom_u_loading_icon2 + _easycom_u_swiper_indicator2)();
|
||||
}
|
||||
const _easycom_u_loading_icon = () => "../u-loading-icon/u-loading-icon.js";
|
||||
const _easycom_u_swiper_indicator = () => "../u-swiper-indicator/u-swiper-indicator.js";
|
||||
if (!Math) {
|
||||
(_easycom_u_loading_icon + _easycom_u_swiper_indicator)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: _ctx.loading
|
||||
}, _ctx.loading ? {
|
||||
b: common_vendor.p({
|
||||
mode: "circle"
|
||||
})
|
||||
} : {
|
||||
c: common_vendor.f(_ctx.list, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: $options.getItemType(item) === "image"
|
||||
}, $options.getItemType(item) === "image" ? {
|
||||
b: $options.getSource(item),
|
||||
c: _ctx.imgMode,
|
||||
d: common_vendor.o(($event) => $options.clickHandler(index)),
|
||||
e: $options.addUnit(_ctx.height),
|
||||
f: $options.addUnit(_ctx.radius)
|
||||
} : {}, {
|
||||
g: $options.getItemType(item) === "video"
|
||||
}, $options.getItemType(item) === "video" ? {
|
||||
h: `video-${index}`,
|
||||
i: $options.getSource(item),
|
||||
j: $options.getPoster(item),
|
||||
k: _ctx.showTitle && $options.testObject(item) && item.title ? item.title : "",
|
||||
l: $options.addUnit(_ctx.height),
|
||||
m: common_vendor.o(($event) => $options.clickHandler(index))
|
||||
} : {}, {
|
||||
n: _ctx.showTitle && $options.testObject(item) && item.title && $options.testImage($options.getSource(item))
|
||||
}, _ctx.showTitle && $options.testObject(item) && item.title && $options.testImage($options.getSource(item)) ? {
|
||||
o: common_vendor.t(item.title)
|
||||
} : {}, {
|
||||
p: common_vendor.s($options.itemStyle(index)),
|
||||
q: index
|
||||
});
|
||||
}),
|
||||
d: $options.addUnit(_ctx.height),
|
||||
e: common_vendor.o((...args) => $options.change && $options.change(...args)),
|
||||
f: _ctx.circular,
|
||||
g: _ctx.interval,
|
||||
h: _ctx.duration,
|
||||
i: _ctx.autoplay,
|
||||
j: _ctx.current,
|
||||
k: _ctx.currentItemId,
|
||||
l: $options.addUnit(_ctx.previousMargin),
|
||||
m: $options.addUnit(_ctx.nextMargin),
|
||||
n: _ctx.acceleration,
|
||||
o: _ctx.displayMultipleItems,
|
||||
p: _ctx.easingFunction
|
||||
}, {
|
||||
q: !_ctx.loading && _ctx.indicator && !_ctx.showTitle
|
||||
}, !_ctx.loading && _ctx.indicator && !_ctx.showTitle ? {
|
||||
r: common_vendor.p({
|
||||
indicatorActiveColor: _ctx.indicatorActiveColor,
|
||||
indicatorInactiveColor: _ctx.indicatorInactiveColor,
|
||||
length: _ctx.list.length,
|
||||
current: $data.currentIndex,
|
||||
indicatorMode: _ctx.indicatorMode
|
||||
})
|
||||
} : {}, {
|
||||
s: common_vendor.s($options.addStyle(_ctx.indicatorStyle)),
|
||||
t: _ctx.bgColor,
|
||||
v: $options.addUnit(_ctx.height),
|
||||
w: $options.addUnit(_ctx.radius)
|
||||
});
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-4e7d0c90"]]);
|
||||
my.createComponent(Component);
|
||||
8
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.json
vendored
Normal file
8
unpackage/dist/dev/mp-alipay/uni_modules/uview-plus/components/u-swiper/u-swiper.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"styleIsolation": "apply-shared",
|
||||
"usingComponents": {
|
||||
"u-loading-icon": "../u-loading-icon/u-loading-icon",
|
||||
"u-swiper-indicator": "../u-swiper-indicator/u-swiper-indicator"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user