//就是e.detail.value不能赋值给其他变量
formSubmit: function (e) {
console.log('form发生了submit事件,携带数据为:', e.detail.value.name)
values = e.detail.value
this.setData({
flag1:true,
name1: e.detail.value.name,
time_diff1: e.detail.value.time_diff,
time1:goodtime(time_diff)
})
}
})
thirdScriptError
values is not defined;at pages/test/test page formSubmit function
ReferenceError: values is not defined
at e.formSubmit (http://127.0.0.1:37389/appservice/pages/test/test.js:79:12)
at e.<anonymous> (http://127.0.0.1:37389/appservice/__dev__/WAService.js:18:16884)
at e.a (http://127.0.0.1:37389/appservice/__dev__/WAService.js:18:10983)
at z (http://127.0.0.1:37389/appservice/__dev__/WAService.js:18:4899)
at Function.<anonymous> (http://127.0.0.1:37389/appservice/__dev__/WAService.js:18:6520)
at http://127.0.0.1:37389/appservice/__dev__/WAService.js:18:12486
at http://127.0.0.1:37389/appservice/__dev__/WAService.js:6:27996
at e.(anonymous function) (http://127.0.0.1:37389/appservice/__dev__/WAService.js:4:5071)
at a (http://127.0.0.1:37389/appservice/appservice?t=1529377874528:1018:9472)
at e.registerCallback (http://127.0.0.1:37389/appservice/appservice?t=1529377874528:1018:9659)
你的 values 是哪来的?定义了吗?能不能访问到?
或者这样写:
var values = e.detail.value
哦。。。我犯了个低级错误,,python写多了
其实 js 也可以不声明就直接用的,但是如果开了“严格模式”那就必须要声明了。另外齐神头像瞩目_(:з」∠)_
哈哈哈哈哈,被发现了。貌似小程序默认是严格模式。