当前位置:网站首页>Wechat applet pages always report errors when sending values to the background. It turned out to be this pit!
Wechat applet pages always report errors when sending values to the background. It turned out to be this pit!
2022-07-03 12:16:00 【favoritecode】
Wechat applet Page value transfer to background event.currentTarget.dataset It must be followed by lowercase English , Do not use capital English , Otherwise, it will be wrong .
<view class="goodsShow" bindtap="clickItem" wx:for="{
{goodsShowList}}" wx:item="item" wx:key="key" data-orderGoods="{
{item}}" data-orderid="{
{item._id}}">
<view class="itemShow">{
{item.goodsInfo[0].goodsName}}</view>
</view>
data-ordeGoods="{ {item}}" Page upload value background ,data- It can be followed by upper or lower case English letters .
clickItem: function (event) {
var orderGoods = event.currentTarget.dataset.ordergoods
console.log("orderGoods:", orderGoods)
},
event.currentTarget.dataset. It must be followed by lowercase English letters , It can be compared with data-orderGoods="{ {item}}" atypism , Of course, consistency is also right . Otherwise, the report will be wrong , Such as :
clickItem: function (event) {
var orderGoods = event.currentTarget.dataset.orderGoods
var goodsInfo = orderGoods.goodsInfo[0]
console.log("goodsINfo:", goodsInfo)
console.log("orderGoods:", orderGoods)
},

orderGoods: undefined The system doesn't recognize ! ha-ha , The same as long as there is a capital word, it will report an error , Different as long as js If it is in lowercase, no error will be reported ! What kind of pit is this ! I'm always trapped in this place , Poo Tong !
边栏推荐
- LeetCode 0556.下一个更大元素 III - 4步讲完
- [MySQL special] read lock and write lock
- regular expression
- ArcGIS application (XXI) ArcMap method of deleting layer specified features
- 【mysql专项】读锁和写锁
- Solution to the second weekly test of ACM intensive training of Hunan Institute of technology in 2022
- Php Export word method (One MHT)
- Shutter: add gradient stroke to font
- If you can't learn, you have to learn. Jetpack compose writes an im app (I)
- 023 ([template] minimum spanning tree) (minimum spanning tree)
猜你喜欢

New features of ES6

Swagger

Integer string int mutual conversion

Is BigDecimal safe to calculate the amount? Look at these five pits~~
![[official MySQL document] deadlock](/img/2d/04e97d696f20c2524701888ea9cd10.png)
[official MySQL document] deadlock

During FTP login, the error "530 login incorrect.login failed" is reported

Socket TCP for network communication (I)

QT OpenGL texture map

Talk about the state management mechanism in Flink framework

Unicode encoding table download
随机推荐
OpenGL 索引缓存对象EBO和线宽模式
Solution à la défaillance de l'installation d'Electron
[learning notes] DP status and transfer
vulnhub之Nagini
Develop plug-ins for idea
Cacti monitors redis implementation process
Symlink(): solution to protocol error in PHP artisan storage:link on win10
抓包整理外篇fiddler———— 会话栏与过滤器[二]
Optimize interface performance
ES6 standard
257. All paths of binary tree
OpenGL 绘制彩色的三角形
How to convert a numeric string to an integer
PHP導出word方法(一mht)
[combinatorics] permutation and combination (example of permutation and combination)
Why can't my MySQL container start
PHP export word method (one MHT)
Test classification in openstack
【mysql专项】读锁和写锁
Socket TCP for network communication (I)