当前位置:网站首页>Wechat applet - a case of comparing the size of numbers
Wechat applet - a case of comparing the size of numbers
2022-06-12 01:39:00 【A little orange cat】
Page effects

Page style
/**index.wxss**/
view {
margin: 50rpx;
}
input {
width: 600rpx;
margin-top: 20rpx;
border-bottom: 2rpx solid #ccc;
}
button {
margin: 50rpx;
}
button {
color: #fff;
background: #FF6000;
letter-spacing: 12rpx;
}Page design
<!--index.wxml-->
<view>
<text> Please enter the first 1 A digital :</text>
<input type="number" bindchange="num1change" />
</view>
<view>
<text> Please enter the first 2 A digital :</text>
<input type="number" bindchange="num2change" />
</view>
<button bindtap="compare"> Compare </button>
<view>
<text> Comparison results :{
{result}}</text>
</view>Page logic
// index.js
// Get application instance
const app = getApp()
Page({
/**
* Initial data of the page
*/
data: {
result: ''
},
num1: 0, // Save the first 1 A digital
num2: 0, // Save the first 2 A digital
num1change: function(e) {
this.num1 = Number(e.detail.value)//e.detail.value Get the value entered by the user ,Number() Transfer string to numeric type
console.log(' The first 1 Numbers are ' + this.num1)
},
num2change: function(e) {
this.num2 = Number(e.detail.value)
console.log(' The first 2 Numbers are ' + this.num2)
},
compare: function(e) {
var str = ' Two numbers are equal '
if (this.num1 > this.num2) {
str = ' The first 1 It's a big number '
} else if (this.num1 < this.num2) {
str = ' The first 2 It's a big number '
}
this.setData({
result: str
})
// this.data.result = str // This method does not change the... In the page {
{result}} Value
}
})边栏推荐
- Entity class dto to VO is converted through plug-in
- PCA from 0 to 1
- Chinese Version Vocaloid AI Tuner Feasibility Test
- Image retrieval based on cross modal AI model
- 【项目实训】校验注解
- Blue Bridge Cup - 2012b Group real question 3 specific drinking capacity
- Article 7: Design of multifunctional intelligent trunk following control system | undergraduate graduation project - [module device selection, list and data]
- 联调这夜,我把同事打了...
- 【科普视频】到底什么是透镜天线?
- Shadow implementation of unity vertex animation
猜你喜欢

西南林业大学“西林链”通过工信部电子标准院功能测试 | FISCO BCOS案例

Matlab 基础应用02 wind 股票数据介绍和使用案例:

Tiobe - programming language ranking in June 2022

In 2022, the internal promotion of the "MIHA Tour" golden, silver and silver social recruitment started in April and march! Less overtime, good welfare, 200+ posts for you to choose, come and see!

kali安装empire过程中遇到的各种报错解决方案

Weibull Distribution韦布尔分布的深入详述(2)参数和公式意义

Defect detection, introduction to Halcon case.

Annotate your own point cloud dataset with labelcloud open source tool as a tutorial of Kitti annotation format (support PCD and bin point clouds)

Set up NFT blind box mall system | customized development of NFT mall software

The annual salary of testers in large factories ranges from 300000 to 8K a month. Roast complained that the salary was too low, but he was ridiculed by netizens?
随机推荐
[从零开始学习FPGA编程-20]:快速入门篇 - 操作步骤4-2-Altera Quartus II工具的快速使用(modelSim联合仿真、程序下载到Altera开发板)
Weibull Distribution韦布尔分布的深入详述(2)参数和公式意义
2022年金属非金属矿山(小型露天采石场)安全管理人员考试模拟100题及模拟考试
Detailed explanation and examples of common parameters of curl
联调这夜,我把同事打了...
Operation of simulated examination platform of diazotization process examination question bank in 2022
新知识:Monkey 改进版之 App Crawler
Image retrieval based on cross modal AI model
Simplified interpretation of accuracy and recall in AI papers
Interviewer: do you understand redis' shared object pool?
Go language learning summary (7) -- Dachang go programming specification summary
These three sentences make you not confused when you understand that you are an we media. I just do this. The monthly income of video has exceeded 10000 yuan
Huawei intermodal game or application review rejected: the application detected payment servicecatalog:x6
How to buy children's serious illness insurance, what to pay attention to and how to choose products
MATLAB basic application 02 wind stock data introduction and use case:
Shadow implementation of unity vertex animation
【项目实训】校验注解
实体类DTO转VO通过插件转化
Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
Colorize Voronoi Diagram Template