当前位置:网站首页>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 !
边栏推荐
- regular expression
- Dynamically monitor disk i/o with ZABBIX
- Fluent: Engine Architecture
- (构造笔记)ADT与OOP
- Introduction to concurrent programming (II)
- repo Manifest Format
- Qt OpenGL 纹理贴图
- (construction notes) grasp learning experience
- 安装electron失败的解决办法
- [combinatorics] permutation and combination (example of permutation and combination)
猜你喜欢
随机推荐
Atomic atomic operation
Dart: view the dill compiled code file
shardingSphere分库分表<3>
Unicode encoding table download
Use of QT OpenGL camera
"Jianzhi offer 04" two-dimensional array search
Quantitative calculation research
Vulnhub's Tomato (tomato)
Master and backup role election strategy in kept
(database authorization - redis) summary of unauthorized access vulnerabilities in redis
Dart: about grpc (I)
Duplicate numbers in the array of sword finger offer 03
adb push apk
DEJA_ Vu3d - 054 of cesium feature set - simulate the whole process of rocket launch
Use of atomicinteger
Wechat applet development - page Jump transfer parameters
Laravel time zone timezone
为什么我的mysql容器启动不了呢
Differences between MySQL Union and union all
Shell: basic learning








