
小程序
余德淦
这个作者很懒,什么都没留下…
展开
-
关于array.findindex的问题和array.map的问题
let a = [ 1,2,3,4]//注意findindex的查询语句不能加{},要不然index只会出现-1let index1 = a.findIndex(e => e ===2)let index2 = a.findIndex(e => { e ===3})console.log(index1,"index1")console.log(index2,"index2")原创 2020-10-08 04:52:31 · 273 阅读 · 0 评论 -
小程序云开发数据库和云函数的使用问题
更改了云函数之后要先ctrl+s再上传,要不然云函数不会更新调用云函数对云数据库进行update,不管权限设置为什么,都能通过云函数对数据库进行update 1 在微信开发工具中,数据权限设置为所有用户可读,仅创建者可读写时,调用云函数能对云数据库进行update { "read": true, "write": "doc._openid == auth.openid"}2 数据权限设置为所有用户可读,调用云函数仍然能对云数据库进行update{ "read": true,.原创 2020-09-24 02:03:17 · 660 阅读 · 0 评论 -
const的小问题
const声明的变量只可以在声明时赋值,不可随意修改,这是最大的特点所以如果后面变量的值会被修改的时候不要用const来声明变量如果前面声明了const,相同的变量前面就不要再写const了const a =2const a = 3这种写法在微信开发工具里面有可能只报错,然后不知道原因const a = 3a = 4这种也是不行的,const不能赋予新值...原创 2020-09-23 01:50:40 · 144 阅读 · 0 评论 -
小程序从getCurrentPages()拿出来的数据
let pages = getCurrentPages()console.log(pages,"页面栈") console.log(pages[pages.length-1].options.goods_id,"goods_id")从getcurrentpages里拿到的goods_id是字符串来的然而从appdata中拿到的数据是number注意从getcurrentpages中获取的参数是字符串形式的,所以good_id===this.data.goodsObj.goods_id为false原创 2020-09-18 21:41:04 · 380 阅读 · 0 评论 -
javas中判断语法
const index = -1const iscollect = !index===-1console.log(iscollect)注意无论index取什么值,iscollect都是falseWelcome to Node.js v12.18.3.Type ".help" for more information.> 0===-1false> !0===-1false原创 2020-09-18 20:56:21 · 114 阅读 · 0 评论 -
小程序在云函数里面调用数据库不需要wx.cloud
当使用云函数报错时,要排查一下问题1 是否在app.js中是否初始化云环境们是否设置了env环境id2 是否在云函数中先初始化云环境再调用api3 是否在云函数中使用了没有的moduleError: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 62024166-f8b0-11ea-af5e-525400742e8d, cloud function servi原创 2020-09-17 14:58:38 · 298 阅读 · 0 评论 -
小程序中的button无法正常使用
由于小程序的样式表被user agent stylesheet给覆盖了,所以button无法显示出正常的大小这里会使得button的大小不是均匀分布的,分享的button会覆盖另外两个button,所以我们要想把user agent stylesheet给除掉。...原创 2020-09-16 15:30:40 · 809 阅读 · 0 评论