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>
<view>
<image :src="isError ? defaultImage : links[currentIndex]" :style="{ width: width, height: height }"
@ -17,10 +38,12 @@
// props
const props = defineProps({
// links
links: {
type: Array,
default: () => []
},
//
width: {
type: String,
default: '65rpx'
@ -29,26 +52,32 @@
type: String,
default: '65rpx'
},
//
objectFit: {
type: String,
default: 'aspectFill'
},
//
defaultImage: {
type: String,
default: ''
},
//
interval: {
type: Number,
default: 80
},
// falsemountedtrue
playing: {
type: Boolean,
default: false
},
//
showButton: {
type: Boolean,
default: false
},
//
loop: {
type: Boolean,
default: false