lucky-canvas
lucky-canvas copied to clipboard
大转盘在真机上点击的时候背景图片和奖品图片消失了
- 你当前是什么框架(必填):uniapp
- 你使用的是哪个包(必填):@lucky-canvas/uni
- 你当前插件的版本(必填):1.7.26
- 当前环境是小程序还是浏览器(选填):小程序
- 详细描述你的bug:大转盘在真机上点击的时候背景图片和奖品图片消失了
- 问题代码(重要):
// 代码开始, 别再放歪了行吗
<template>
<view class="content">
<LuckyWheel
ref="myLucky"
width="650rpx"
height="650rpx"
:blocks="blocks"
:prizes="prizes"
:buttons="buttons"
@start="startCallBack"
@end="endCallBack" />
</view>
</template>
<script lang="ts" setup>
import LuckyWheel from '../components/@lucky-canvas/uni/lucky-wheel.vue'
const myLucky = ref()
const blocks = [
{
padding: '55rpx',
imgs: [
{
src: '/page_activity/static/image/circle.png',
width: '650rpx',
height: '650rpx',
rotate: true
}
]
}
]
const prizes = [
{
fonts: [{ text: '0', top: '10%' }],
background: '#fcd063',
imgs: [
{
src: '/page_activity/static/image/circle.png',
width: '30px',
height: '30px'
}
]
},
{ fonts: [{ text: '1', top: '10%' }], background: '#f1e2ce' },
{ fonts: [{ text: '2', top: '10%' }], background: '#fcd063' },
{ fonts: [{ text: '3', top: '10%' }], background: '#f1e2ce' },
{ fonts: [{ text: '4', top: '10%' }], background: '#fcd063' },
{ fonts: [{ text: '5', top: '10%' }], background: '#f1e2ce' }
]
const buttons = [
{ radius: '45px', background: '#ffb929' },
{
radius: '40px',
background: '#000',
pointer: true,
fonts: [{ text: 'GO', top: '-20px' }]
}
]
const startCallBack = () => {
// 先开始旋转
myLucky.value.play()
// 使用定时器来模拟请求接口
setTimeout(() => {
;``
// 假设后端返回的中奖索引是0
const index = 4
// 调用stop停止旋转并传递中奖索引
myLucky.value.stop(index)
}, 3000)
}
// 抽奖结束触发回调
const endCallBack = (prize) => {
// 奖品详情
console.log(prize)
}
</script>
// 代码结束
#435 不是这个的问题。
我也遇到这个问题了,和楼主基本一样
遇到了相同的错误,有什么好的解决方案么
后来就放弃这个,找的其他代替了
后来就放弃了这个,找到其他代替了
用的谁的项目