init
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<uni-swiper-dot
|
||||
:info="props.data.items"
|
||||
:current="current"
|
||||
field="content"
|
||||
mode="round"
|
||||
:dots-styles="{
|
||||
backgroundColor: '#D6D6D6',
|
||||
border: '1px #D6D6D6 solid',
|
||||
color: '#fff',
|
||||
selectedBackgroundColor: 'var(--color2)',
|
||||
selectedBorder: '1px var(--color2) solid',
|
||||
selectedWidth: '4',
|
||||
selectedHight: '4',
|
||||
bottom: '8',
|
||||
height: '4',
|
||||
}"
|
||||
>
|
||||
<swiper
|
||||
:style="{
|
||||
...props.styles,
|
||||
overflow: 'hidden',
|
||||
}"
|
||||
:indicator-dots="props.data.indicatorDots"
|
||||
:indicator-color="props.data.indicatorColor"
|
||||
:indicator-active-color="props.data.indicatorActiveColor"
|
||||
:circular="props.data.circular"
|
||||
:interval="props.data.interval"
|
||||
:autoplay="props.data.autoplay"
|
||||
:duration="props.data.duration"
|
||||
@change="change"
|
||||
>
|
||||
<swiper-item v-for="(item, index) in props.data.items" :key="index" @click="go(item.url)">
|
||||
<image style="width: 100%; height: 100%" :src="item.picUrl" mode="aspectFill"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</uni-swiper-dot>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
let current = ref(0);
|
||||
// 轮播图
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
indicatorColor: '#D6D6D6', //点颜色
|
||||
indicatorActiveColor: '#FE4246', //当前点颜色
|
||||
autoplay: true, //是否自动切换
|
||||
interval: 3000, //自动切换时间间隔
|
||||
circular: true, //是否衔接滑动
|
||||
indicatorDots: true, //是否显示面板指示点
|
||||
}),
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const change = (e) => {
|
||||
current.value = e.detail.current;
|
||||
};
|
||||
|
||||
const go = (url, obj = {}) => {
|
||||
if (!url) {
|
||||
uni.showToast({
|
||||
title: '功能开发中, 敬请期待',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
data: obj,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
||||
Reference in New Issue
Block a user