game-wheel
v0.0.6
Published
``` npm install game-wheel ```
Downloads
1
Readme
game-wheel
转盘抽奖
安装
npm install game-wheel
使用
- json
{
"usingComponents": {
"game-wheel": "game-wheel/index"
}
}
- js
Page({
data: {
wheelData: {
rotTimes: 1,//抽奖次数
rootStyle: "",
bgImg: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01LBPD1z1FJvZ4flfAV_!!1080040467.png",
btnImg: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01aMztV01FJvZ2WXlsd_!!1080040467.png",
btnStyle: "",
prizeList: [
{
name: '汤臣倍健Yep',
img: 'https://gw.alipayobjects.com/zos/rmsportal/nIQUKeYBbJWliGJVhVmx.png'
}, {
name: '请继续发光吧',
img: 'https://gw.alipayobjects.com/zos/rmsportal/HkrVjjjuxZPUMCUbPazb.png'
}, {
name: 'GALAXY',
img: 'https://gw.alipayobjects.com/zos/rmsportal/cDctUxwBLPCszQHRapYV.png'
}, {
name: '无门槛优惠券',
img: 'https://gw.alipayobjects.com/zos/rmsportal/FAmIWZAWpUwlRFKqQDLz.png'
}
],
},
},
onLoad() {
},
onWheelRef(ref) {
this.wheelRef = ref;
},
onWheelStart() {
console.log("点击")
this.setData({
[`wheelData.rotTimes`]: this.data.wheelData.rotTimes + 1
}, () => {
this.wheelRef.start("汤臣倍健Yep");
})
},
onFinish(obj) {
console.log("finish:", obj)
},
});
- xaml
<game-wheel componentData="{{wheelData}}" onRef="onWheelRef" onStart="onWheelStart" onFinish="onFinish" />