当前位置:网站首页>微信小程序接入百度统计报错 Cannot read property ‘mtj‘ of undefined
微信小程序接入百度统计报错 Cannot read property ‘mtj‘ of undefined
2022-06-28 18:30:00 【木头没有瓜】
参考文章微信小程序如何接入百度统计并且自定义事件分析_improvement-CSDN博客_百度统计 自定义事件
接入百度统计,遇到了几个坑
1、第一个坑——微信小程序后台配置了https://hmma.baidu.com域名却没有
登录微信公众平台,进入小程序的设置->开发设置->服务器域名,把https://hmma.baidu.com加入REQUEST合法域名。
由于公司的小程序已经接入了很多域名,所以我将https://hmma.baidu.com添加保存后,再重新进入查看,发现没有添加上,一度以为微信把百度拉黑了,最终发现是因为微信小程序后台会将域名排序,不是最后添加的就会显示在最后,https://hmma.baidu.com这个域名被排序到了中间
2、第二个坑——域名配置后,小程序控制台还是报https://hmma.baidu.com域名不是安全域名
这个简单,但是试了重新编译还不行,心想重启应用能解决80%的问题,重启后就好了
3、第三个坑——Cannot read property 'mtj' of undefined

脑子一万个草泥马,百分百按照教程配置的,怎么就报错了呢,到底是哪里不对呢
原来整个小程序只有一个 App 实例,是全部页面共享的。开发者可以通过 getApp 方法获取到全局唯一的 App 实例,获取App上的数据或调用开发者注册在 App 上的函数。
在app.js中的onLaunch钩子函数,此时实例还未创建,是访问不到实例的方法的,不常用原生开发导致的坑啊
边栏推荐
- Unity about oculus quest2 developing 002-ui interaction based on XR interaction Toolkit
- 注意!PMP紧急缓考今天就截止了!
- Record an emotet Trojan horse handling case
- Concept and code implementation of heap
- Konva series tutorial 3: Customizing drawings
- 被315点名的流氓下载器,又回来了…
- 技术管理进阶——管理者如何做绩效沟通及把控风险
- tensorboard 使用总结
- ⼤⼚⾯试真题集合
- select/poll/epoll
猜你喜欢

Small program graduation project based on wechat chess and card room small program graduation project opening report function reference

Applet graduation project reservation based on wechat housekeeping service applet graduation project opening report function reference

curl: (56) Recv failure: Connection reset by peer

Small program graduation design based on wechat driving school examination small program graduation design opening report function reference

render函数解析

Sword finger offer 11 Minimum number of rotation array

剑指 Offer 11. 旋转数组的最小数字

OneFlow源码解析:算子签名的自动推断

解析机器人主持教学的实践发展

如何设计业务高性能高可用计算架构 - 作业
随机推荐
Small program graduation design based on wechat real estate intermediary house viewing appointment small program graduation design opening report function reference
Seata implementation of sharing JDBC distributed transaction
注意!PMP紧急缓考今天就截止了!
Database mysql statement final review CTGU
亿信华辰:地产企业数字化转型想要把握时代机遇
打破学科之间壁垒的STEAM教育
Analysis of response parsing process of SAP ui5 batch request
Applet graduation design based on wechat beauty salon technician appointment applet graduation design opening report function reference
SqlTransaction
几行代码就能实现复杂的 Excel 导入导出,这个工具类真心强大!
Small program graduation project based on wechat chess and card room small program graduation project opening report function reference
上传文件列表(文件名重复加括号标识)
sqrt()函数的详解和用法「建议收藏」
刷题分析工具
golang json 序列化、反序列化 字符串反序列化成 map[string]interface{}
A preliminary study of IO model
Mycat+ sub database and sub table
Unity about oculus quest2 developing 002-ui interaction based on XR interaction Toolkit
Cann media data processing V2, jpegd interface introduction
剑指 Offer 11. 旋转数组的最小数字