WeChat Mini Programs asked for help

problem description

after the password is entered correctly twice, the registration displays an error

the environmental background of the problems and what methods you have tried

related codes

Page ({
data: {},

)
formSubmit: function (e){
  if(e.detail.value.password == e.detail.value.re_password){
    wx.request({
      url: xxx/regist",
      data: {
        "username": e.detail.value.username,
        "password": e.detail.value.password,
      },
      method: "POST",
      header: {
        "content-type":"application/x-www-form-urlencoded"
      },
      success: function (res){
        console.log(res.data)
        if(res.data.status == 1){
          wx.setStorage({
            key: "username",
            data: "JSON.parse(res.data.data).username",
          })
          wx.showToast({
            title: res.data.message + ",",
            icon: "success",
            duration: 2000
          })
        } else {
          wx.showToast({
            title: res.data.message,
            icon: "loading",
            duration: 2000
          })
        }
      }
    })
  } else {
    wx.showToast({
      title: "",
      icon: "loading",
      duration: 2000
    })
 }

},
})

what result do you expect? What is the error message actually seen?


showToast:fail parameter error: parameter.title should be String instead of Undefined;
console.error @ VM3533:1
Y @ WAService.js:6
z @ WAService.js:6
vs @ WAService.js:10
(anonymous) @ WAService.js:6
(anonymous) @ WAService.js:7
(anonymous) @ WAService.js:14
(anonymous) @ WAService.js:6
success @ regist.js? [sm]: 28
function.a. (anonymous function) @ WAService.js:7
(anonymous) @ WAService.js:4
(anonymous) @ WAService.js:7
L.emit @ WAService.js:8
(anonymous) @ WAService.js:12
(anonymous) @ WAService.js:6
(anonymous) @ appservice?t=1535532018517:1043
b.emit @ appservice?t=1535532018517:1043
callback @ appservice?t=1535532018517:1043
setTimeout @ appservice?t=1535532018517:1043
(anonymous) @ WAService.js:4 < WAService.js:4 > br @ br Js:4
setTimeout (async)
setTimeout @ WAService.js:4
n @ appservice?t=1535532018517:1043
c @ appservice?t=1535532018517:1043
v.onreadystatechange @ appservice?t=1535532018517:1043
XMLHttpRequest.send (async)
Q @ appservice?t=1535532018517:1043
createRequestTask @ appservice?t=1535532018517:1043
invoke @ appservice?t=1535532018517:1043
invoke @ WAService.js:4
U @ WAService.js:6
H @ WAService.js:6
Rt @ WAService.js:7
e @ WAService.js:12 @ WAService.js:14
(anonymous) @ WAService.js:6
formSubmit @ regist.js? [sm]: 5
(anonymous) @ WAService.js:19
l @ WAService.js:18
Dt @ WAService.js:19
ln @ WAService.js:20
(anonymous) @ WAService.js:20
(anonymous) @ WAService.js:19
(anonymous) @ WAService.js:10
n @ appservice?t=1535532018517:1043
a @ appservice?t=1535532018517:1043
e.registerCallback @ appservice?t=1535532018517:1043
n.forEach @ appservice?t=1535532018517:1043
d @ appservice?t=1535532018517:1043
k.onmessage @ appservice?t=1535532018517:1043

May.11,2021
The title parameter of the

wx.showToast method requires a string. Check whether the result of your stitching is a string

.
Menu