diff --git a/index.js b/index.js
new file mode 100644
index 0000000..9d3aeda
--- /dev/null
+++ b/index.js
@@ -0,0 +1,61 @@
+// index.js
+// 获取应用实例
+const app = getApp()
+
+Page({
+ data: {
+ num:'0',
+ op:''
+ },
+result: null,
+isClear: false,
+numBtn: function(e) {
+ var num = e.target.dataset.val
+ if (this.data.num === '0' || this.isClear) {
+ this.setData({ num: num })
+ this.isClear = false
+ } else {
+ this.setData({ num: this.data.num + num })
+ }
+},
+opBtn: function(e) {
+ var op = this.data.op
+ var num = Number(this.data.num)
+ this.setData({ op: e.target.dataset.val })
+ if (this.isClear) {
+ return
+ }
+ this.isClear = true
+ if (this.result === null) {
+ this.result = num
+ return
+ }
+ if (op === '+'){
+ this.result = this.result + num
+ } else if (op === '-') {
+ this.result = this.result - num
+ } else if (op === '*') {
+ this.result = this.result * num
+ } else if (op === '/') {
+ this.result = this.result / num
+ } else if (op === '%') {
+ this.result = this.result % num
+ }
+ this.setData({ num: this.result + '' })
+},
+dotBtn: function(){
+ if(this.isClear){
+ this.isClear=false
+ return
+ }
+ this.setData({num:this.data.num+'.'})
+},
+delBtn:function(){
+ var num = this.data.num.substr(0,this.data.num.length-1)
+ this.setData({num: num==='' ?'0' :num})
+},
+resetBtn:function(){
+ this.result = null
+ this.isClear = false
+ this.setData({ num:'0',op:''})
+}})
diff --git a/index.json b/index.json
new file mode 100644
index 0000000..178d89a
--- /dev/null
+++ b/index.json
@@ -0,0 +1,6 @@
+{
+ "usingComponents": {},
+ "navigationBarBackgroundColor":"#fff",
+ "navigationBarTitleText":"计算器",
+ "navigationBarTextStyle":"black"
+}
diff --git a/index.wxml b/index.wxml
new file mode 100644
index 0000000..07ed2d4
--- /dev/null
+++ b/index.wxml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ C
+ DEL
+ %
+ ÷
+
+
+ 7
+ 8
+ 9
+ ×
+
+
+ 4
+ 5
+ 6
+ -
+
+
+ 1
+ 2
+ 3
+ +
+
+
+ 0
+ .
+ =
+
+
+
+ {{num}}
+ {{op}}
+
diff --git a/index.wxss b/index.wxss
new file mode 100644
index 0000000..3b023a5
--- /dev/null
+++ b/index.wxss
@@ -0,0 +1,61 @@
+/**index.wxss**/
+page {
+ display: flex;
+ flex-direction: column;
+ height: 100%
+ }
+ .result{
+ flex:1;
+ background:#ffffff;
+ }
+ .btns{
+ flex:1;
+ }
+ .bg {
+ background: #eee;
+ }
+ .btns {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ font-size: 17pt;
+ border-top: 1rpx solid #ccc;
+ border-left: 1rpx solid #ccc;
+ }
+ .btns > view {
+ flex: 1;
+ display: flex;
+ }
+ .btns > view > view {
+ flex-basis: 187.5rpx;
+ border-right: 0rpx solid #ccc;
+ border-bottom: 0rpx solid #ccc;
+ box-sizing: border-box;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ .btns > view:last-child > view:first-child {
+ flex-basis: 375rpx;
+ }
+ .btns > view:first-child > view:first-child {
+ color: #f00;
+ }
+ .btns>view>view:last-child{
+ color:#fc8e00
+ }
+ .result{
+ flex: 2;
+ margin: 25px;
+ position: absolute;
+ }
+ .result-num{
+ font-size: 27pt;
+ bottom: 5vh;
+ right: 3vw;
+ }
+ .result-op{
+ font-size: 15pt;
+ bottom: 1vh;
+ right: 3vw;
+ }
\ No newline at end of file