Comments (5)
@yanxi-me
// 如果已经引用过其他版本,wx 变量结果是 undefined
const wx = require('weixin-js-sdk')
// 正确写法
const wx = window.jWeixin || require('weixin-js-sdk')
from weixin-js-sdk.
如果是直接引入浏览器是不存在这个问题的
只有在 npm 多模块引用的情形下 会形成我上面的结构
CommonJS 版本需要处理这个问题
from weixin-js-sdk.
由于代码里会判断 window.jWeixin
如果其他包里引用了 其他版本的 weixin-js-sdk ,再次引用时 window.jWeixin 已经存在
导致代码逻辑不正确
既然代码里判断了 window.jWeixin,如果之前引入过其他版本的包,再次引入时就不会执行相关代码啊
from weixin-js-sdk.
@yejiajiehz 明白了,谢谢
from weixin-js-sdk.
新版本已经解决此问题
from weixin-js-sdk.
Related Issues (20)
- index.js报错
- 你好,什么时候更新jweixin-1.4.0.js正式版本? HOT 2
- chooseImage唤起相册很慢 HOT 1
- 用的是1.40-test,IOS端getLocalImgData失败 HOT 2
- 微信支付提示url未注册,只有一个人可以支付,其他都alert url未注册,什么情况
- agentConfig is not a function HOT 1
- 请问下还更新嘛jweixin-1.6.0.js HOT 9
- jssdk1.6.0的版本出来了,作者继续维护吗 HOT 1
- ios和部分安卓,微信长按识别二维码总是调起系统的保存图片功能,没有二维码选项 HOT 1
- 在Andriod 机上。调用updateAppMessageShareData 和 updateTimelineShareData 方法设置分享参数。分享图片没有显示出来。 HOT 1
- 能不能返回苹果几的型号 HOT 1
- ios微信 7.0.18 在测试公众号上,updateAppMessageShareData,updateTimelineShareData设置无效
- 能否支持人脸核身? HOT 1
- 安卓使用onPageStateChange,监听页面变化,不生效,ios可以 HOT 1
- 安装成功后引用wx,打印的值为undefined HOT 5
- 有版本更新日志吗 HOT 3
- ios调用updateAppMessageShareData没有success HOT 2
- 关于公众号h5分享功能的一些疑问 HOT 3
- typescript wx.miniProgram.navigateBack 定义有误 HOT 1
- error An unexpected error occurred
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weixin-js-sdk.