至少没验证价格和数量是不是数字,而且传上去的也是文本,没处理成数字。
小程序多次添加数据到一个云数据库上,后台云数据库只接收第一次的数据,这是个bug么?wxml <text>商品名称</text> <input bindinput="Getname"> </input> <text>商品价格</text> <input bindinput="Getprice"> </input> <text>商品数量</text> <input bindinput="Getnumber"> </input> <text>商品详情及联系方式</text> <input bindinput="Getdetail" style="width: 750rpx; height: 244rpx; display: block; box-sizing: border-box"> </input> <button bindtap="Getimg" style="position: relative; left: 0rpx; top: 122rpx">上传商品图片</button> <button bindtap="Getdata" style="position: relative; left: 0rpx; top: 244rpx">上传商品</button> js如下希望大佬救救我 let Name='' let Price='' let Number='' let Detail='' let Img='' let picUrl='' Page({ data:{ list:[], img:'', fileList:[], fileIDs:[] }, onload(){ this.getlist() }, getlist(){ wx.cloud.database.collection('goods') .get() .then(res=>{ console.log('获取数据成功',res) this.setData({ list:res.data }) }) .catch(err=>{ console.log('获取数据失败',err) }) }, Getname(e){ Name=e.detail.value console.log(Name) }, Getprice(e){ Price=e.detail.value console.log(Price) }, Getnumber(e){ Number=e.detail.value console.log(Number) }, Getdetail(e){ Detail=e.detail.value console.log(Detail) }, Getdata(){ console.log('添加的商品名',Name) console.log('添加的商品价格',Price) //检测名字是否合法 if(Name==''){ wx.showToast({ icon:'none', title:'商品名称为空' }) } else if(Price==''){ wx.showToast({ icon:'none', title:'商品价格为空' }) } else if(Number==''){ wx.showToast({ icon:'none', title:'商品数量为空' }) } else if(Detail==''){ wx.showToast({ icon:'none', title:'商品详情及联系方式为空' }) } else{ wx.cloud.database().collection('goods').add({ data:{ name:Name, price:Price, number:Number, detail:Detail // img:tempFilePath }}) .then(res=>{ console.log("添加数据成功",res) }) .catch(err=>{ console.log("添加数据失败",err) }) } }, Getimg(){ wx.chooseImage({ success:res=>{ var filePath=res.tempFilePaths[0] this.cloudFile(filePath) } }) }, cloudFile(path){ wx.cloud.uploadFile({ cloudPath:Date.now()+".jpg", filePath:path }) .then(res=>{ this.setData({ picUrl:res.fileID, img:res.fileID }) let fileID=res.fileID; wx.cloud.database().collection("goods").add ({ data:{ img:fileID }, success:res=>{ console.log('图片上传成功',res) }, fail:err=>{ console.log('图片上传失败',err) } }) }) }, })
2022-03-27上线后也是这样,先button的bindtap。这不对啊
bindblur和bindtap执行顺序问题?一个input一个button,在input的bindblur中写到this.data,button的bindtap获取上传。问题是模拟器先bindblur,再bindtap,符合我的设想。但预览正相反,,导致没得到值。发布后啥样我不知道。怎么确保先写到this.data,再执行bindtap呢?
2022-03-23让type不起作用好了。或是where里的对象在外面先处理好
在云函数中查询数据的时候能不能根据小程序端传过来的值进行查询?const type=event.type; return await db.collection("ns_users").where({ staname:_.in(['学员']), checkinfo:true }).orderBy("posttime","desc").limit(10).skip(page).get() 在云函数中,type是我从小程序端传递进来的,我想要根据这个type 获取不同的结果,如果type是空的话就还是查询这些,如果type有值那就查询另一个字段,我不想这样写,看看还有别的办法吗? const type=event.type; if(type){ return await db.collection("ns_users").where({ staname:_.in(['学员']), checkinfo:true, type:type }).orderBy("posttime","desc").limit(10).skip(page).get() }else{ return await db.collection("ns_users").where({ staname:_.in(['学员']), checkinfo:true }).orderBy("posttime","desc").limit(10).skip(page).get() }
2020-07-09onShareAppMessage,对方收到后点击图片,应该进小程序,但跳出这个提示。
预览没法分享给别人测试了?[图片] [图片] 预览,分享给别人想多用户测试一下,来这么个东西。上一个小程序不是这个版本的开发者工具可以的。
2020-07-08自己最靠谱
想自己创业,开发个小程序,如何找靠谱的小程序开发者?help help ,find someone to help me with pay
2020-07-06建商户表,有必要的表加商户字段。没建过数据库?
小程序怎么做到支持多家商户单独使用?一个小程序,怎么能做到在一个小程序内让多家商户使用。要求: 小程序内的内容,商家可以自己修改自己门店的东西,但是不改变其他商户的信息。 我的想让我的小程序供给全国的其他分店使用。
2020-07-06{{"<"}}
组件里怎么写小于号?<text><30</text>
2020-06-30找到原因了,bindinput函数写了async,想从云函数验证一下再return。结果就。。。
bindinput任何return,value都是"[object Promise]",为什么?原来是好的,今天这样了。
2020-06-13我也这样,多刷几次才行,好象没被唤醒一样
云函数配额调整后还是超出资源?使用云函数提示{"errorCode":-1,"errorMessage":"ResourceLimitReached"} 怎么解
2020-06-10用组件肯定大了,自己需要的功能写一下就好了
小程序有没有可能加入电子表格组件?或者那位朋友加入了外部的电子表格组件?可计算的电子表格 spreadsheet 对某些应用的开发来说是非常快捷的,有没有人引入类似sheetjs之类的外部插件?
2020-05-15