提交树形组件,但是逻辑和结构不合适,重构

This commit is contained in:
augushong
2021-04-07 23:04:08 +08:00
parent f15b3a8b4f
commit 2fb658d085
4 changed files with 265 additions and 18 deletions

View File

@@ -84,8 +84,36 @@
})
}
renderRepeat('body')
$('.demo-js-src').each(function () {
var html = $(this).html();
var htmlList = html.split(/[\n]/g);
var htmlListNew = []
var baseLineBlankNums = -1;
htmlList.forEach(function (htmlLine, htmlIndex) {
if (htmlIndex == 0 && htmlLine.length == 0) {
return true
}
if (baseLineBlankNums < 0) {
var kong = htmlLine.match(/^ */g) //筛选
if (kong != null) {
baseLineBlankNums = kong[0].length
} else {
baseLineBlankNums = 0
}
}
htmlListNew.push(htmlLine.slice(baseLineBlankNums))
});
$(this).siblings('pre.demo-js').html(htmlListNew.join("\n"))
})
layui.form.render()
layui.element.render()
layui.code({
encode: true
})
</script>
</body>