Page({
global : {
timer : null ,
isRand : false
},
data: {
dice : ['first','second','third','fourth','fifth','sixth'],
buttonType : 'primary',
buttonValue : '摇一摇',
isShow:'hidden',
num1 : 0,
num2 : 0,
num3 : 0,
total: 0
},
shakeClick: function () {
let me = this;
this.global.isRand = !this.global.isRand;
if ( this.global.isRand ) {
this.global.timer = setInterval(function (){
let num1 = Math.floor(Math.random()*6);
let num2 = Math.floor(Math.random()*6);
let num3 = Math.floor(Math.random()*6);
me.setData({num1 : num1});
me.setData({num2 : num2});
me.setData({num3 : num3});
me.setData({total : num1+num2+num3+3});
},50);
} else {
clearInterval(this.global.timer);
}
this.setData({
dice: this.data.dice,
buttonType : (this.global.isRand) ? 'default' : 'primary',
buttonValue : (this.global.isRand) ? '停止' : '摇一摇',
isShow: (this.global.isRand) ? 'hidden':'show',
});
},
})
高仿麻将游戏:附详细教程小程序源码.zip
需积分: 5 143 浏览量
2023-11-13
15:12:20
上传
评论 1
收藏 52KB ZIP 举报
等天晴i
- 粉丝: 3478
- 资源: 10万+
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈