showToast:fail parameter error: paramete
入门选手,跟着视频教程检查代码,编译后报错,云函数正常,页面显示不出来,求老手解,谢过。。 - 当前 Bug 的表现(可附上截图) [图片] [图片] - 预期表现 - 复现路径 - 提供一个最简复现 Demo [代码]// miniprogram/pages/list/list.js[代码][代码]function[代码] [代码]fixZero(num) {[代码][代码] [代码][代码]return[代码] [代码]num < 10 ? [代码][代码]'0'[代码] [代码]+ num : num;[代码][代码]}[代码] [代码]Page({[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面的初始数据[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]list: [],[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 生命周期函数--监听页面加载[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码][代码] [代码][代码]this[代码][代码].getData();[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]dealData: [代码][代码]function[代码] [代码](list, callback) {[代码][代码] [代码][代码]var[代码] [代码]fileList = [];[代码] [代码] [代码][代码]list.forEach([代码][代码]function[代码] [代码](item) {[代码][代码] [代码][代码]var[代码] [代码]date = [代码][代码]new[代码] [代码]Date(item.time);[代码] [代码] [代码][代码]item.timeInfo = {[代码][代码] [代码][代码]year: date.getFullYear(),[代码][代码] [代码][代码]month: fixZero(date.getMonth() + 1),[代码][代码] [代码][代码]date: fixZero(date.getDate()),[代码][代码] [代码][代码]hours: fixZero(date.getHours()),[代码][代码] [代码][代码]miniutes: fixZero(date.getMinutes())[代码][代码] [代码][代码]};[代码] [代码] [代码][代码]fileList.push(item.img);[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]wx.cloud.getTempFileURL({[代码][代码] [代码][代码]fileList: fileList,[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]var[代码] [代码]fileList = res.fileList;[代码] [代码] [代码][代码]list.forEach([代码][代码]function[代码] [代码](item, index) {[代码][代码] [代码][代码]item.img = fileList[index].tempFileURL;[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]callback(list);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](err) {[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: err[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]getData: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]// var db = wx.cloud.database();[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码] [代码] [代码][代码]wx.cloud.callFunction({[代码][代码] [代码][代码]// 云函数名称[代码][代码] [代码][代码]name: [代码][代码]'db'[代码][代码],[代码][代码] [代码][代码]// 传给云函数的参数[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]type: [代码][代码]'get'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'获取成功'[代码][代码]);[代码][代码] [代码][代码]console.log(res);[代码][代码] [代码][代码]var[代码] [代码]result = res.result || {};[代码] [代码] [代码][代码]that.dealData(result.data, [代码][代码]function[代码] [代码](data) {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]list: data[代码][代码] [代码][代码]});[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]// db.collection('list').get({[代码][代码] [代码][代码]// success: function (res) {[代码][代码] [代码][代码]// console.log('获取数据成功', res);[代码] [代码] [代码][代码]// that.dealData(res.data, function (data) {[代码][代码] [代码][代码]// console.log(data);[代码] [代码] [代码][代码]// that.setData({[代码][代码] [代码][代码]// list: data[代码][代码] [代码][代码]// });[代码][代码] [代码][代码]// });[代码][代码] [代码][代码]// }[代码][代码] [代码][代码]// });[代码][代码] [代码][代码]}[代码][代码]})[代码]