You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我觉得你说 @coohuo的也不对,p=s[s.length-1].src;,并不一定是当前iShare的路径。我觉得最好判断一下。 var js = document.scripts; var path = ""; var c=js.length; for(var i=0;i<c;i++){ var it=js[i]; var src=it.src; if(src.indexOf("iShare")>=0){ path=src.substring(0,src.lastIndexOf('/')+1) } } Util.loadjs(path+'qrcode.min.js', this.wx.startQR());
当然这里的indexOf('iShare')也不能保证加载的就是iShare.js,如果用户改名了,这个文件不叫iShare.js了,那就不好办了。
引入qrcode.min.js文件,需要在引用页面的同级目录下。不然,二维码无法出现
如,某站首页****/index.html、子页面****/XXX/index.html的同级目录,分别有qrcode.min.js
试了对loadjs函数这样调整后,可以自动加载在iShare.js|iShare_tidy.js同级目录的qrcode.min.js文件
iShare_tidy.js 409行
W3C = document.dispatchEvent, js = document.scripts, path = js[js.length - 1].src; path = path.substring(0, path.lastIndexOf('/')+1); cb.push(callback); if(!ready){ node.setAttribute('type', 'text/javascript'); node.setAttribute('id', 'loaded'); node.setAttribute('src', path+url);
iShare_tidy.min.js
j=document.dispatchEvent后增加
,s=document.scripts,p=s[s.length-1].src;p=p.substring(0,p.lastIndexOf('/')+1)
k.setAttribute("src",h)调整为
k.setAttribute("src",p+h)
配置项container的'id'模式无效,代码_node = document.getElementById(selector); 尝试进行如下调整,去掉#,id模式正常
_node = document.getElementById(selector.slice(1));
min压缩版,f=document.getElementById(e)改成了f=document.getElementById(e.slice(1)),正常
@zhansingsong 请查看
The text was updated successfully, but these errors were encountered: