const StringUtil = require('../../utils/StringUtil.js');
//获取应用实例
var app = getApp()
Page({
data: {
result: '0',
operator: '',
userInfo: {}
},
onLoad: function () {
var that = this
//调用应用实例的方法获取全局数据
app.getUserInfo(function(userInfo){
//更新数据
that.setData({
userInfo:userInfo
})
})
},
// 百分百
tapPercent: function() {
},
// 数字
tapNumber: function(e) {
// console.log('数字按钮:', e);
const num = e.currentTarget.dataset['value'];
if (num) {
this.data.result += num;
const fmtNumber = StringUtil.formatNumber(this.data.result);
// 限制最大长度
if (fmtNumber.length > 11)
return;
this.setData({
result: fmtNumber
});
} else {
console.warn('对应的 data-value 属性异常!');
}
},
// 加减乘除
tapOperator: function(e) {
console.log('tap: ', e);
const opt = e.currentTarget.dataset['value'];
if (opt) {
this.setData({
operator: opt
});
}
},
// 等于
tapCalculate: function() {
console.log('等于:');
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序 - 高仿苹果计算器源码.zip
共8个文件
js:3个
wxss:2个
wxml:1个
需积分: 5 0 下载量 57 浏览量
2024-05-02
09:24:25
上传
评论
收藏 16KB ZIP 举报
温馨提示
微信小程序 - 高仿苹果计算器【源码】.zip
资源推荐
资源详情
资源评论
收起资源包目录
微信小程序 - 高仿苹果计算器【源码】.zip (8个子文件)
1.png 15KB
weixin_calculate-master
pages
index
index.wxml 2KB
index.js 1KB
index.wxss 859B
app.json 178B
app.js 566B
utils
StringUtil.js 646B
app.wxss 173B
共 8 条
- 1
资源评论
依邻依伴
- 粉丝: 1839
- 资源: 213
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功