当前位置:网站首页>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 !
边栏推荐
- Introduction to concurrent programming (I)
- [combinatorics] permutation and combination (summary of permutation and combination content | selection problem | set permutation | set combination)
- PHP导出word方法(一phpword)
- QT OpenGL texture map
- 【嵌入式】---- 内存四区介绍
- Talk about the state management mechanism in Flink framework
- OpenGL draws colored triangles
- Redis notes 01: Introduction
- PHP export word method (one MHT)
- 20. Valid brackets
猜你喜欢
4000 word super detailed pointer
OpenGL 索引缓存对象EBO和线宽模式
ES6 standard
If you can't learn, you have to learn. Jetpack compose writes an im app (I)
Unicode encoding table download
Solve msvcp120d DLL and msvcr120d DLL missing
Laravel time zone timezone
New features of ES6
【mysql专项】读锁和写锁
Shutter widget: centerslice attribute
随机推荐
网上炒股开户安不安全?谁给回答一下
Dart: about Libraries
DEJA_VU3D - Cesium功能集 之 053-地下模式效果
LeetCode 0556.下一个更大元素 III - 4步讲完
【附下载】密码获取工具LaZagne安装及使用
Php Export word method (One MHT)
Optimize interface performance
Dart: self study system
Flutter: about monitoring on flutter applications
手机号码变成空号导致亚马逊账号登陆两步验证失败的恢复网址及方法
Shutter: about inheritedwidget
Adult adult adult
PHP导出word方法(一phpword)
Socket TCP for network communication (I)
PHP導出word方法(一mht)
Interview experience in summer camp of Central South University in 2022
vulnhub之Nagini
(构造笔记)MIT reading部分学习心得
023 ([template] minimum spanning tree) (minimum spanning tree)
(database authorization - redis) summary of unauthorized access vulnerabilities in redis