buuing / lucky-canvas

🎖🎖🎖 基于 TS + Canvas 开发的【大转盘 / 九宫格 / 老虎机】抽奖插件,🌈 一套源码适配多端框架 JS / Vue / React / Taro / UniApp / 微信小程序等,🎨 奖品 / 文字 / 图片 / 颜色 / 按钮均可配置,支持同步 / 异步抽奖,🎯 概率前 / 后端可控,🚀 自动根据 dpr 调整清晰度适配移动端

Home Page:https://100px.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

老虎机

hefeiping0808 opened this issue · comments

  • 你当前是什么框架(必填):react
  • 你使用的是哪个包(必填):魔改作者的代码
  • 你当前插件的版本(必填):不知道
  • 当前环境是小程序还是浏览器(选填):浏览器
  • 详细描述你的bug:我设置了10个插槽,填0~9时可以正常渲染,填1~10时渲染异常
  • 问题代码(重要):
// 代码开始, 别再放歪了行吗
<div id="my-lucky"></div>

<script>
  const myLucky = new LuckyCanvas.SlotMachine('#my-lucky', {
    width: '300px',
    height: '22px',
    slots: [
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
      {},
    ],
    defaultStyle: {
      borderRadius: Infinity,
      background: '#bac5ee',
      fontSize: '16px',
      fontColor: '#fff'
    },
    prizes: [
      { fonts: [{ text: '1',  }] },
      { fonts: [{ text: '2',  }] },
      { fonts: [{ text: '3',  }] },
      { fonts: [{ text: '4',  }] },
      { fonts: [{ text: '5',  }] },
      { fonts: [{ text: '6',  }] },
      { fonts: [{ text: '7',  }] },
      { fonts: [{ text: '8',  }] },
      { fonts: [{ text: '9',  }] },
      { fonts: [{ text: '10',  }] },
    ],
    defaultConfig: {
      rowSpacing: '10px',
      colSpacing: '10px'
    }
  })
  // 开始
  myLucky.play()
  setTimeout(() => myLucky.stop([7,6,8,4,9,3,2,10,1,5]), 2000)
</script>

// 代码结束

以上代码得出的结果是:[8,7,9,5,10,4,3,10,2,6]