企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 实现加载json文件图片 ***** >[info] 核心代码 ~~~ <h2>loading...<span id="progress">0%</span></h2> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.bootcss.com/PreloadJS/1.0.1/preloadjs.min.js"></script> <script> var queue = new createjs.LoadQueue(false); //可以在此指定某个文件夹 // var queue = new createjs.LoadQueue(false, 'images/'); var progress = $("#progress"); //监听进度事件 queue.on("progress", function(e){ var proNum = Math.ceil(e.progress * 100); progress.html( proNum + "%"); }); //监听完成事件 queue.on("complete", function(){ console.log("加载完成"); }); queue.loadManifest('img.json'); queue.on("fileload", function (e) { // console.log(e.result); $.each(e.result, function (i, n) { console.log(n); }) }); </script> ~~~ >[info] img.json代码 ~~~ [{"id":1,"src":"images\/arrow.png"},{"id":1,"src":"images\/arrow.png"},{"id":1,"src":"images\/arrow.png"},{"id":1,"src":"images\/arrow.png"}] ~~~