lucky-canvas
lucky-canvas copied to clipboard
range属性用法不太明白
- 你当前是什么框架(必填):原生微信小程序
- 你使用的是哪个包(必填):原生微信小程序
- 你当前插件的版本(必填):1.1.1
- 当前环境是小程序还是浏览器(选填):小程序
- 详细描述你的bug:range未生效,或者文档没太说明该属性使用
- 问题代码(重要):
// 代码开始, 别再放歪了行吗
<lucky-wheel id="myLucky" width="600rpx" height="600rpx" blocks="{{blocks}}" prizes="{{prizeObj}}" wx:if="{{loginStatus}}" buttons="{{buttons}}" defaultStyle="{{defaultStyle}}" bindstart="start" bindend="end" />
prizeObj =[{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"10元无门槛红包"}],"background":"#f8d384","range":1,"id":5,"title":"10元无门槛红包"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"20元无门槛红包"}],"background":"#f9e3bb","range":1,"id":6,"title":"20元无门槛红包"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"满100减30红包"}],"background":"#f8d384","range":1,"id":7,"title":"满100减30红包"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"满50减10红包"}],"background":"#f9e3bb","range":1,"id":8,"title":"满50减10红包"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"全场八折卷"}],"background":"#f8d384","range":1,"id":9,"title":"全场八折卷"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"全场九折卷"}],"background":"#f9e3bb","range":1,"id":10,"title":"全场九折卷"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"谢谢惠顾"}],"background":"#f8d384","range":1000,"id":11,"title":"谢谢惠顾"},{"imgs":[{"top":"40px","width":"50","height":"50"}],"fonts":[{"top":"18%","text":"谢谢参与"}],"background":"#f9e3bb","range":1000,"id":12,"title":"谢谢参与"}]
start() {
let that = this;
// 获取抽奖组件实例
const $lucky = that.selectComponent('#myLucky')
// 调用play方法开始旋转
$lucky.play()
// 用定时器模拟请求接口
setTimeout(() => {
// 3s 后得到中奖索引
const index = Math.random() * 8 >> 0
// // 调用stop方法然后缓慢停止
$lucky.stop(index)
}, 3000)
},
end(event) {
// 中奖奖品详情
console.log(JSON.stringify(event))
let that = this;
util.showSuccessToast("恭喜您抽中了" + event.detail.title);
},
// 代码结束