This commit is contained in:
Teng 2025-12-08 09:49:36 +08:00
parent e4b3689f5e
commit b3697bc1e3
1 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,24 @@
<!-- 使用示例 已经全局暴露直接用就行 注意这个组件的性能不如用AE写的动画-->
<!-- <donghua :width="`1300rpx`" :height="`900rpx`" :links="blueArray" :playing="photoplay" :loop="true" :interval="120" /> -->
<!-- 注意看参数是什么意思 -->
<!-- 通用的生成函数 这个方法可以快速让你写出图片数组
function genPaths(base, prefix, count, ext = 'png', startIndex = 0, pad = false) {
return Array.from({ length: count }, (_, i) => {
const idx = pad
? String(i + startIndex).padStart(2, '0')
: i + startIndex
return `${base}/${prefix}${idx}.${ext}`
})
} -->
<!-- 数组的示例
const leftArray = ref(genPaths(
'/static/index/newindex/leftmenu',地址
'',图片前缀
3, //
'png', 类型
0, //
false //
)) -->
<template> <template>
<view> <view>
<image :src="isError ? defaultImage : links[currentIndex]" :style="{ width: width, height: height }" <image :src="isError ? defaultImage : links[currentIndex]" :style="{ width: width, height: height }"
@ -17,10 +38,12 @@
// props // props
const props = defineProps({ const props = defineProps({
// links
links: { links: {
type: Array, type: Array,
default: () => [] default: () => []
}, },
//
width: { width: {
type: String, type: String,
default: '65rpx' default: '65rpx'
@ -29,26 +52,32 @@
type: String, type: String,
default: '65rpx' default: '65rpx'
}, },
//
objectFit: { objectFit: {
type: String, type: String,
default: 'aspectFill' default: 'aspectFill'
}, },
//
defaultImage: { defaultImage: {
type: String, type: String,
default: '' default: ''
}, },
//
interval: { interval: {
type: Number, type: Number,
default: 80 default: 80
}, },
// falsemountedtrue
playing: { playing: {
type: Boolean, type: Boolean,
default: false default: false
}, },
//
showButton: { showButton: {
type: Boolean, type: Boolean,
default: false default: false
}, },
//
loop: { loop: {
type: Boolean, type: Boolean,
default: false default: false