当前位置:网站首页>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 !
边栏推荐
- During FTP login, the error "530 login incorrect.login failed" is reported
- PHP export word method (phpword)
- Swagger
- Php Export word method (One MHT)
- (database authorization - redis) summary of unauthorized access vulnerabilities in redis
- Shutter: about inheritedwidget
- OPenGL 基本知识(根据自己理解整理)
- Dart: view the dill compiled code file
- 4000字超详解指针
- 257. All paths of binary tree
猜你喜欢

【mysql专项】读锁和写锁

"Jianzhi offer 04" two-dimensional array search

Why can't my MySQL container start

Develop plug-ins for idea

使用BLoC 构建 Flutter的页面实例

Pki/ca and digital certificate

If you can't learn, you have to learn. Jetpack compose writes an im app (I)

2.7 overview of livedata knowledge points

Introduction to the implementation principle of rxjs observable filter operator

Vulnhub's Tomato (tomato)
随机推荐
Dart: about Libraries
Dart: about grpc (I)
257. All paths of binary tree
Talk about the state management mechanism in Flink framework
LeetCode 0556.下一个更大元素 III - 4步讲完
Symlink(): solution to protocol error in PHP artisan storage:link on win10
Unity3d learning notes 5 - create sub mesh
Shell: basic learning
【附下载】密码获取工具LaZagne安装及使用
1-1 token
Redis
Solutions to the failure of installing electron
php 获取文件夹下面的文件列表和文件夹列表
wpa_ cli
Colleagues wrote a responsibility chain model, with countless bugs
Redis 笔记 01:入门篇
(構造筆記)從類、API、框架三個層面學習如何設計可複用軟件實體的具體技術
【mysql官方文档】死锁
Dart: self study system
QT OpenGL rotate, pan, zoom