当前位置:网站首页>Use Wx The showactionsheet selection box modifies the information in the database. Why does it report an error that data is not defined
Use Wx The showactionsheet selection box modifies the information in the database. Why does it report an error that data is not defined
2022-04-22 02:05:00 【CSDN Q & A】
The phenomenon and background of the problem
Problem related code , Do not paste screenshots
wx.showActionSheet({ itemList: this.data.gly, success (res) { console.log(res.tapIndex) if(res.tapIndex===0){ db.collection("lyj").doc(e.currentTarget.id).update({ data:{ ['sj.'+this.data.sjxxindex+'.0']:0 }, success:res=>{ console.log("cheng success ") }, }) }else if(res.tapIndex===1){ db.collection("lyj").doc(e.currentTarget.id).update({ data:{ ['sj.'+this.data.sjxxindex+'.0']:2 }, }) }else if(res.tapIndex==2){ db.collection("lyj").doc(e.currentTarget.id).update({ data:{ ['sj.'+this.data.sjxxindex+'.0']:1 }, success:res=>{ wx.showToast({ title:' Modification successful ', icon:'success', duration:2000,}) } }) } }, fail (res) { console.log(res.errMsg,' Modification failed ') } })
Operation results and error reporting contents
VM758 WAService.js:2 TypeError: Cannot read property 'data' of undefined
at success (reserve.js:276)
at Object.s. (VM758 WAService.js:2)
at VM758 WAService.js:2
at Module.Sr (VM758 WAService.js:2)
at VM758 WAService.js:2
at qJ (VM758 WAService.js:2)
at r.success (VM758 WAService.js:2)
at :65031/appservice/
at Object.success (VM758 WAService.js:2)
at a (VM758 WAService.js:2)(env: macOS,mp,1.05.2203030; lib: 2.23.4)
My solution ideas and tried methods
What I want to achieve
Take the answer :
Maybe the third line doesn't use the arrow function , Lead to this Caused by different references .
// The third line success:(res)=>{
版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204142352455263.html
边栏推荐
- 单层神经⽹络的详细实现
- C -- console operation
- DEJA_ Vu3d - cesium feature set 013 - military plotting Series 7: regular polygon
- Leetcode 1572, sum of diagonal elements of matrix
- Analysis and interpretation of the current situation and challenges faced by enterprise operation and maintenance in the digital era
- The purpose of software testing, why do you do software testing?
- PaddlePaddle basic usage details (four), PaddlePaddle training text classification model
- Introduction to Matlab (I)
- 最长公共子串
- R language generalized linear model GLM: linear least squares, logarithmic transformation, Poisson, binomial logistic regression analysis, ice cream sales time series data and simulation
猜你喜欢

QT程序打包成一个exe可执行文件

Nacos 为什么这么强

Leetcode 21. Merge two ordered linked lists

Advanced C language formula 41: analysis of classical problems of memory operation I

Basic operation of MySQL database ------ (basic addition, deletion, query and modification)

JVM - GC垃圾回收器

Leetcode 566, remodeling matrix

IP message analysis notes

Why is Nacos so strong

QT program is packaged into an EXE executable file
随机推荐
[programming question] character set
Page 58 Siemens digital solutions for machine tool industry
Analyticdb PostgreSQL's new version of cloud native allows users to focus on business. What kind of experience upgrade does it achieve?
Swoole high performance in memory database use and configuration tutorial
Jetcode prize essay solicitation activity | interesting stories of low code industry waiting for you to share
Page 50 JD cloud · Ruiqing - building an agile engine for enterprise digital transformation business midrange solution
718. Longest repeating subarray
Android four components interview
Hj4 string separator
高级android面试答案,Gradle源码全解析
102 page master plan for new generation digital transformation and informatization
Stack and queue
The purpose of software testing, why do you do software testing?
HJ6 质数因子
From the test results of full memory, full local disk cache, half cache and half OSS, what are the conclusions?
Unity3d RPG role playing game source code (top and bottom) --- source code analysis ----- 01 ------ protagonist character animation
(counting line segment tree) lintcode medium 248 · count the number of numbers smaller than a given integer
Time and current time judgment in MySQL database
718. 最长重复子数组
68 smart pipe gallery project construction solution