小程序
小游戏
企业微信
微信支付
扫描小程序码分享
向云函数中传递参数a和b查询数据库,看到有示例代码,
data:{ //传递
a:1,
b:2
}
1和2这个传递是ok的,但是我想实现把input组件里用户输入的字符当作参数传递给云函数,或者用变量传递过去,总是不成功,不知道代码应该怎样写?或者用什么其他方式实现?谢谢
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
不成功是怎么写的?
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
getRecord() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId,
},
data: {
type: 'selectRecord',
chengshi:'深圳'// 换为chengshi:inputValue 就会报错
}).then((resp) => {
this.setData({
haveGetRecord: true,
record: resp.result.data
wx.hideLoading();
}).catch((e) => {
console.log(e);
showUploadTip: true
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
不成功是怎么写的?
getRecord() {
wx.showLoading({
title: '',
});
wx.cloud.callFunction({
name: 'quickstartFunctions',
config: {
env: this.data.envId,
},
data: {
type: 'selectRecord',
chengshi:'深圳'// 换为chengshi:inputValue 就会报错
}
}).then((resp) => {
this.setData({
haveGetRecord: true,
record: resp.result.data
});
wx.hideLoading();
}).catch((e) => {
console.log(e);
this.setData({
showUploadTip: true
});
wx.hideLoading();
});
},