Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro+React大转盘奖品图片无法显示 #489

Open
Linxiaoxxx opened this issue May 29, 2024 · 8 comments
Open

Taro+React大转盘奖品图片无法显示 #489

Linxiaoxxx opened this issue May 29, 2024 · 8 comments

Comments

@Linxiaoxxx
Copy link

  • 你当前是什么框架(必填):taro
  • 你使用的是哪个包(必填):@lucky-canvas/taro
  • 你当前插件的版本(必填): "^0.0.14"
  • 当前环境是小程序还是浏览器(选填):小程序
  • 详细描述你的bug:使用大转盘时,无法显示本地奖品图片
  • 问题代码(重要):
// 代码开始, 别再放歪了行吗
import { LuckyWheel } from '@lucky-canvas/taro/react'
import { useRef } from 'react'

export default function Wheel() {
  const myLucky = useRef<any>()
  const prizes = [
    {
      img: [
        {
          src: '../../../assets/images/I.png',
          top: '10%',
          width: '50%',
          height: '50%'
        }
      ],
      background: '#4c90f5'
    },
    { img: [{ src: '../../../assets/images/I.png', top: '10%', width: '100rpx', height: '100rpx' }], background: '#3bb35f' },
    { img: [{ src: '../../../assets/images/I.png', top: '10%', width: '100rpx', height: '100rpx' }], background: '#f34434' },
    { img: [{ src: '../../../assets/images/I.png', top: '10%', width: '100rpx', height: '100rpx' }], background: '#fcc601' }
  ]

  return (
    <LuckyWheel
      ref={myLucky}
      width='516rpx'
      height='516rpx'
      prizes={prizes}
      onStart={() => {
        myLucky.current?.play()
        setTimeout(() => {
          // 假设后端返回的中奖索引是0
          const index = 0
          // 调用stop停止旋转并传递中奖索引
          myLucky.current?.stop(index)
        }, 2500)
      }}
      onEnd={(prize) => {
        // 抽奖结束会触发end回调
        console.log(prize)
      }}
    ></LuckyWheel>
  )
}

// 代码结束
@Linxiaoxxx
Copy link
Author

网络图片也不可以显示呢

@mega16
Copy link

mega16 commented May 30, 2024

问题+1~ 不停刷新页面,一会儿正常,一会儿又不正常

@buuing
Copy link
Owner

buuing commented May 30, 2024

小程序端的抽奖已经很久没维护的

@buuing
Copy link
Owner

buuing commented May 30, 2024

为啥不维护了呢, 因为更新和改动太频繁了, 微信小程序+uniapp+taro, 这仨谁都有可能出问题, 如果全都跟进的话, 我就一个人, 业余时间就不用干别的了, 像泥潭一样拖住我, 这个兼容taro的代码, 至少在3年前是可以完美运行的, 这边建议自行排查一下问题, 他改动估计也就是api方面的改动, 底层设计不会变的

@mega16
Copy link

mega16 commented May 30, 2024

看来只能看源码研究了! issue这么多说明这个库还是十分有价值的。

@buuing
Copy link
Owner

buuing commented May 30, 2024

源码不至于, 直接看@lucky-canvas/taro这个包就行了

@buuing
Copy link
Owner

buuing commented May 30, 2024

兼容也没用, 时效性很短, 说不定啥时候taro又改动了

@zhouhui-zh99
Copy link

uniapp 图片加载也是一样的 就是有部分图片显示有部分图片不显示 点击抽奖过后 就全部图片显示了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants