我用的是 第二种
上代码
首先引入 layui的css和js
html
部分
<div class="layui-progress" lay-showpercent="true" style="margin-top:10px" lay-filter="demo-filter-progress">
<div class="layui-progress-bar" lay-percent="1/{$files_int}"></div>
</div>
JS
部分
jindu = jindu-1
layui.use(function(){
var element = layui.element;
var util = layui.util;
element.progress('demo-filter-progress', currentIndex +'/'+ zongarr); // 设置
element.render('demo-filter-progress'); // 重新渲染进度条
});
layui.use(function(){
var element = layui.element;
var util = layui.util;
element.progress('demo-filter-progress', jindu +'/'+ zongarr); // 设置
element.render('demo-filter-progress'); // 重新渲染进度条
});