当前位置:网站首页>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 !
边栏推荐
- Solution à la défaillance de l'installation d'Electron
- Cacti monitors redis implementation process
- AOSP ~ NTP (Network Time Protocol)
- DNS multi-point deployment IP anycast+bgp actual combat analysis
- Basic knowledge of OpenGL (sort it out according to your own understanding)
- PHP導出word方法(一mht)
- win10 上PHP artisan storage:link 出现 symlink (): Protocol error的解决办法
- previous permutation lintcode51
- 023(【模板】最小生成树)(最小生成树)
- OpenGL 着色器使用
猜你喜欢
随机推荐
1-1 token
MySQL time zone solution
2.9 overview of databinding knowledge points
CGroup introduction
Atomic atomic operation
Shardingsphere sub database and sub table < 3 >
repo Manifest Format
[learning notes] DP status and transfer
安装electron失败的解决办法
win10 上PHP artisan storage:link 出现 symlink (): Protocol error的解决办法
QT OpenGL texture map
adb push apk
Dart: view the dill compiled code file
How to deploy web pages to Alibaba cloud
2.7 overview of livedata knowledge points
[MySQL special] read lock and write lock
257. All paths of binary tree
regular expression
239. Sliding window maximum
ES6新特性









