Before回调中使用stopPropagation(); 强行打断进程
layui.use('upload', function() {var upload = layui.upload;//执行实例var uploadInst = upload.render({elem: '#uploade', //绑定元素url: '/upload', //上传接口size: 1024 * 2,accept: 'images',acceptMime: 'image/jpg, image/png',before: function(res) {if(imglist.length>5){layer.msg("上传图片不能超过5张!", { icon: 2, offset: "auto", time: 3000 });stopPropagation();}},done: function(res) {//上传完毕回调console.log(res.data.url, "成功回调")imglist.push(res.data.url)},error: function() {//请求异常回调}});});