当前位置:懂科普 >

IT科技

> 微信自带计算器功能在哪里

微信自带计算器功能在哪里

打开微信开发工具,新建一个项目,命名为calculate。

新建page,输入名称为calculate。

calculate目录下自动生成4个文件

打开calculate.json文件,使其pages/calculate/calculate文件处在第一项。

微信自带计算器功能在哪里

5.编写calculate.wxml,输入:

微信自带计算器功能在哪里 第2张

6.编写calculate.wcss,输入:.container{justify-content: flexstart;padding:30rpx0;}

container input{background-color: #eee;border-radius: 3px;text-align: left;width: 720rpx;height: 100rpx;line-height: 100rpx;margin:20rpx;}container button{width: 100%;

微信自带计算器功能在哪里 第3张

7.编写calculate.js,输入代码:data:{num1:"",num2:"",result:""},getNum1:function(e){var n=e.detail.value;if(!isNaN(n{this.setData({num1:n});}},getNum2:function(e{var n=e.detail.value;if(!isNaN(n)){this.setData({num2:n});}},add:function(e){varn=this.data.num1*1+this.data.num2*1;this.setData({result:n});},

微信自带计算器功能在哪里 第4张

微信自带计算器功能在哪里 第5张

8.输入完成后,保存代码,得到如下计算器的界面如下。

微信自带计算器功能在哪里 第6张

9.在输入框中,输入数字,并点击确定按钮,则得到运算结果。

微信自带计算器功能在哪里 第7张

以上便是针对该问题所整理出来的具体操作步骤,希望可以帮助到需要的朋友。

标签: 微信 计算器
  • 文章版权属于文章作者所有,转载请注明 https://dongkepu.com/itkeji/3v033g.html