微信小程序 加法计算器

微信小程序 加法计算器,第1张

1、新建目录calc

2、pages加上

"pages/calc/calc",

3、 calc.wxml

<view class="container">

<input placeholder="被加数" bindinput="bindInput1" />

<input placeholder="加数" bindinput="bindInput2" />

<button type="primary" bindtap="bindAdd">计算</button>

<input placeholder="结果" value="{{result}}" disabled />

</view>

4、calc.wxss

/* pages/calc/calc.wxss */

.container{

justify-content: flex-start

padding: 30rpx 0

}

.container input{

background-color: #eee

border-radius:3px

text-align:left

width:720rpx

height:100rpx

line-height:100rpx

margin:20rpx

}

.container button{

width:80%

}

5、calc.json

{

"navigationBarBackgroundColor":"#00ff00",

"navigationBarTitleText":"加法计算器",

"navigationBarTextStyle":"white",

"usingComponents": {}

}

6、calc.js

// pages/calc/calc.js

Page({

/**

tabs数组对象下的值进行条件判断并修改属性值 isActive数组对象属性,v数组对象,i遍历下标

tabs.forEach((v,i)=>i===index?v.isActive=true:v.isActive=false)

collect数组对象下的值进行条件判断并修改属性值 goods_id数组对象属性,v数组对象,有一个满足的查询到了返回true

collect.some(v =>v.goods_id === this.GoodsInfo.goods_id)

//every必须每个都满足 否则是false

Array.every()

var a = [["a","b","c"],["d","e"],["1","2","3"]]

var b= ["4","5","6"]

a.push(b)

console.log(a)

直接用push()就可以了


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/11862341.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存