You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
524 B
27 lines
524 B
Page({
|
|
data: {
|
|
num1: 0,
|
|
num2: 0,
|
|
result: ''
|
|
},
|
|
|
|
num1Input: function(e) {
|
|
this.setData({ num1: Number(e.detail.value) });
|
|
},
|
|
|
|
num2Input: function(e) {
|
|
this.setData({ num2: Number(e.detail.value) });
|
|
},
|
|
|
|
compare: function() {
|
|
var str = '-';
|
|
if (this.data.num1 > this.data.num2) {
|
|
str = '第一个数大';
|
|
} else if (this.data.num1 < this.data.num2) {
|
|
str = '第二个数大';
|
|
} else {
|
|
str = '两个数相等';
|
|
}
|
|
this.setData({ result: str });
|
|
}
|
|
}); |