gm-game-dice
v1.0.2
Published
``` npm install gm-game-dice ```
Downloads
1
Readme
gm-game-dice
掷色子
安装
npm install gm-game-dice
使用
- json
{
"usingComponents": {
"dice": "gm-game-dice/dice"
}
}
- js
Page({
data: {
numbers: [
{ src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01JLhPnn1FJvZr7FTmF_!!1080040467.jpg" },
{ src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01uPNn5T1FJvZrg12Ae_!!1080040467.jpg" },
{ src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01VdkXfm1FJvZr7FHIz_!!1080040467.jpg" },
{ src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01L5Hx1B1FJvZuY7FXF_!!1080040467.jpg" },
{ src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01MS0zRa1FJvZuFL4Ak_!!1080040467.jpg" },
{ src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01d6H3Ur1FJvZuY9WsO_!!1080040467.jpg" },
]
},
onLoad() {
},
onStop(num) {
console.log("结束:", num)
}
});
- xaml
<!--
组件会挂在在页面上,获取组件方式:this.$page.diceComponent
width,height:色子单面宽高
numbers:色子数字数组[{src:"https://img.alicdn.com/imgextra/i3/1080040467/O1CN01JLhPnn1FJvZr7FTmF_!!1080040467.jpg"}]
animationTime: 动画时间,默认1500毫秒
startShow:色子最开始是否在可视区域
isClick:是否可以点击组件执行 false:默认不允许点击
-->
<dice
width="200"
height="200"
numbers="{{numbers}}"
isClick="{{!true}}"
startShow="{{false}}"
animationTime="{{0}}"
onStop="onStop"></dice>