当前位置:网站首页>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 !
边栏推荐
- Colleagues wrote a responsibility chain model, with countless bugs
- temp
- 2.7 overview of livedata knowledge points
- If you can't learn, you have to learn. Jetpack compose writes an im app (II)
- Unicode encoding table download
- Swagger
- Adult adult adult
- adb push apk
- Introduction to concurrent programming (II)
- ES6新特性
猜你喜欢
Basic knowledge of OpenGL (sort it out according to your own understanding)
Is BigDecimal safe to calculate the amount? Look at these five pits~~
Itext7 uses iexternalsignature container for signature and signature verification
PHP export word method (one MHT)
CGroup introduction
实现验证码验证
Vulnhub's Nagini
Shardingsphere sub database and sub table < 3 >
Symlink(): solution to protocol error in PHP artisan storage:link on win10
PHP export word method (phpword)
随机推荐
Symlink(): solution to protocol error in PHP artisan storage:link on win10
ES6新特性
init. RC service failed to start
抓包整理外篇fiddler———— 会话栏与过滤器[二]
手机号码变成空号导致亚马逊账号登陆两步验证失败的恢复网址及方法
Duplicate numbers in the array of sword finger offer 03
(construction notes) learning experience of MIT reading
4000字超详解指针
shardingSphere分库分表<3>
vulnhub之Nagini
023(【模板】最小生成树)(最小生成树)
CGroup introduction
QT OpenGL rotate, pan, zoom
Qt OpenGL相机的使用
Dart: self study system
023 ([template] minimum spanning tree) (minimum spanning tree)
Use of atomicinteger
DEJA_ Vu3d - cesium feature set 053 underground mode effect
Pki/ca and digital certificate
PHP get the file list and folder list under the folder