lucky-canvas icon indicating copy to clipboard operation
lucky-canvas copied to clipboard

运行环境为Taro v3.6.8,报错

Open wuhongdan opened this issue 6 months ago • 0 comments

代码中直接引入 import {LuckyWheel} from "@lucky-canvas/taro/react";

const ref = useRef(); const data = { blocks: [{ padding: '13px', background: '#617df2' }], prizes: [ { range:1,fonts: [{ text: '0', top: '10%' }], background: '#e9e8fe' }, { range:1,fonts: [{ text: '1', top: '10%' }], background: '#b8c5f2' }, { range:3,fonts: [{ text: '2', top: '10%' }], background: '#e9e8fe' }, { range:1,fonts: [{ text: '3', top: '10%' }], background: '#b8c5f2' }, { range:1,fonts: [{ text: '4', top: '10%' }], background: '#e9e8fe' }, {range:1, fonts: [{ text: '5', top: '10%' }], background: '#b8c5f2' }, {range:1, fonts: [{ text: '6', top: '10%' }], background: '#e9e8fe' }, {range:1, fonts: [{ text: '7', top: '10%' }], background: '#b8c5f2' }, ], buttons: [ { radius: '50px', background: '#617df2' }, { radius: '45px', background: '#afc8ff' }, { radius: '40px', background: '#869cfa', pointer: true, fonts: [{ text: '开始\n抽奖', top: '-20px' }] }, ], }

<LuckyWheel ref={ref} width='300px' height='300px' blocks={data.blocks} prizes={data.prizes} buttons={data.buttons} onStart={() => { // 点击抽奖按钮会触发star回调 // 调用抽奖组件的play方法开始游戏 ref.current.play() // 模拟调用接口异步抽奖 setTimeout(() => { // 假设后端返回的中奖索引是0 const index = 0 // 调用stop停止旋转并传递中奖索引 ref.current.stop() }, 2500) }} onEnd={prize => { // 抽奖结束会触发end回调 console.log(prize) }} ></LuckyWheel> 直接引入代码会报下边这个错误,项目运行不起来 Error: module 'prebundle/node_modules_taro_weapp_prebundle_index-57422a38_css.wxss.js' is not defined, require args is './prebundle/node_modules_taro_weapp_prebundle_index-57422a38_css.wxss'

如果将模块代码全部注释掉,将项目运行起来后,再打开注释掉的模块,可正常使用

wuhongdan avatar Dec 13 '23 08:12 wuhongdan