Open NateRobinson opened 1 year ago
// 代码开始, 别再放歪了行吗 <LuckyGrid ref={myLucky} width="400px" height="400px" blocks={blocks} prizes={prizes.map((item) => ({ ...item, background: blockColor }))} buttons={buttons} defaultStyle={defaultStyle} activeStyle={{ background: activeBlockColor }} onStart={() => { myLucky.current.play(); setTimeout(() => { // eslint-disable-next-line no-bitwise myLucky.current.stop(0); }, 1000); }} onEnd={() => { // 抽奖结束会触发end回调 }} /> // 代码结束
代码不对, 自己检查, 不是bug
@buuing 帮忙指正一下?
activeStyle={{ background: activeBlockColor }}不能这么用吧. 这样搞, 你是不是得给抽奖组件加个key, 每次修改之后, 重新渲染一次组件
activeStyle={{ background: activeBlockColor }}
@buuing 明白,不过上面的 prizes,buttons,defaultStyle 这些这么用是可以实时生效的。我先试试加上 key 让重新渲染试试效果。