如标题,提示加载图片失败,我的天。。。具体如下图:
我的代码超级简单:
var maintests = [ {szPath: "./sprites/audio_icon.png" }, {szPath: "./sprites/bg.jpg" } ]; var totalLen = maintests.length; function loadimg( szPath ){ var img = wx.createImage(); img.src = szPath; img.crossOrigin= "Anonymous" ; img.onload = function (){ filecount(); } } var currentLen = 0; function filecount(){ currentLen ++; if ( currentLen >= totalLen ) { console.log( "完成了" ); } else { console.log( "还在继续" ); } } maintests.forEach(item => { console.log( "请求发起" ); loadimg( item.szPath ); }); |
各位大神走过路过帮忙看下,非常感谢。