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

九宫格网络图片请求了两次 #514

Open
More-duo opened this issue Sep 27, 2024 · 0 comments
Open

九宫格网络图片请求了两次 #514

More-duo opened this issue Sep 27, 2024 · 0 comments

Comments

@More-duo
Copy link

  • 你当前是什么框架(必填):taro
  • 你使用的是哪个包(必填):@lucky-canvas/taro/react
  • 你当前插件的版本(必填):0.0.14
  • 当前环境是小程序还是浏览器(选填):小程序taro
  • 详细描述你的bug:
  • 奖励图片加载请求了两次。大佬,这个点可以优化吗。当展示图片1m左右重复请求两次,渲染效果会慢一些
    image
  • 问题代码(重要):
// 代码开始, 别再放歪了行吗
import { LuckyGrid } from '@lucky-canvas/taro/react';
import { View } from '@tarojs/components';
import { useRef, useState } from 'react';

const GridWheel = () => {
  const gridWheelRef = useRef<any>(null);
  const [showPrizeList] = useState([
    {
      "x": 0,
      "y": 0,
      "imgs": [
        {
          "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500",
          "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500",
          "width": "180rpx",
          "height": "100%"
        },
        {
          "top": "14rpx",
          "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500",
          "width": "132rpx", "height": "132rpx"
        }
      ]
    },
    {
      "x": 1, "y": 0, "id": "0",
      "imgs": [
        {
          "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500", "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%"
        },
        {
          "top": "14rpx",
          "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx" }]
    },
    {
      "x": 2, "y": 0,
      "imgs": [
        {
          "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500",
          "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%"
        },
        { "top": "14rpx", "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx" }]
    },
    {
      "x": 2, "y": 1,
      "imgs": [
        { "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500", "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%" },
        { "top": "14rpx", "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx" }
      ]
    },
    {
      "x": 2, "y": 2,
      "fonts": [{ "top": "148rpx", "fontSize": "24rpx", "text": "", "fontColor": "#63636D", "lineClamp": 1, "fontWeight": "bold", "lengthLimit": 90 }],
      "imgs": [
        { "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500", "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%" },
        { "top": "14rpx", "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx" }
      ]
    },
    {
      "x": 1, "y": 2,
      "imgs": [
        { "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500", "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%" },
        { "top": "14rpx", "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx" }
      ]
    },
    {
      "x": 0, "y": 2,
      "imgs": [
        { "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500", "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%" },
        { "top": "14rpx", "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx" }] },
    {
      "x": 0, "y": 1,
      "imgs": [
        {
          "activeSrc": "https://img1.baidu.com/it/u=3809505498,1140154284&fm=253&fmt=auto&app=138&f=JPEG?w=641&h=500",
          "src": "https://img0.baidu.com/it/u=1053269014,1961200268&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "180rpx", "height": "100%"
        },
        {
          "top": "14rpx",
          "src": "https://img0.baidu.com/it/u=4197942065,3322466659&fm=253&fmt=auto&app=138&f=PNG?w=500&h=500", "width": "132rpx", "height": "132rpx"
        }
      ]
    }
  ])


  return (
    <View>
      <LuckyGrid
        ref={gridWheelRef}
        canvasId='canvas-tang'
        width="600rpx"
        height="600rpx"
        defaultConfig={{
          speed: 10,
          gutter: 10,
        }}
        prizes={[...showPrizeList]}
      />
    </View>
  )
}

export default GridWheel;
// 代码结束
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

1 participant