refactor: var -> let 변경

dev
Jonguk. Lim 5 months ago
parent 6f3debc3c1
commit 8c81591418

@ -85,7 +85,8 @@
<div class="col-md-12">
<div class="border-card rounded w-100 h-px-250 ox-scroll align-content-start">
<ul id="dragAndDrop--${pageName}" class="d-inline-flex">
<%-- <ul id="dragAndDrop--${pageName}" class="d-inline-flex" style="flex-wrap: wrap">--%>
</ul>
</div>
</div>
@ -328,7 +329,7 @@
$P.fnDisplay = () => {
if($P.fileArr.length > 0){
var tagsText = $P.fnMakeImgTags($P.fileArr);
let tagsText = $P.fnMakeImgTags($P.fileArr);
document.querySelector("#dragAndDrop--${pageName}").innerHTML = tagsText;
$("#btnImageDel--${pageName}").removeAttr("hidden");
} else {
@ -340,18 +341,16 @@
// HTML 태그(img,checkbox) 문자열 생성
$P.fnMakeImgTags = (fileArr) => {
var tagsTextArr = [];
let tagsTextArr = [];
for(var index = 0; index < fileArr.length; index++){
var item = fileArr[index];
for(let index = 0; index < fileArr.length; index++){
let item = fileArr[index];
var template = document.getElementById("imgCheckboxTemplate--${pageName}").innerHTML;
let template = document.getElementById("imgCheckboxTemplate--${pageName}").innerHTML;
template = template.replace(/{name}/gi, "dsuseDsuseImgFilesSelector");
template = template.replace(/{value}/gi, item.id);
template = template.replace(/{src}/gi, item.url);
tagsTextArr.push(template);
}
@ -414,14 +413,14 @@
//이미지 삭제 버튼
$("#btnImageDel--${pageName}").on("click", function() {
var checkeds = $("#dragAndDrop--${pageName}").find(":checkbox[name='dsuseDsuseImgFilesSelector']:checked");
let checkeds = $("#dragAndDrop--${pageName}").find(":checkbox[name='dsuseDsuseImgFilesSelector']:checked");
if(checkeds.length > 0){
var keys = [];
let keys = [];
checkeds.each(function(){
keys.push(this.value);
});
$P.fileArr = $P.fileArr.filter((element) => keys.indexOf(element.id) == -1);
$P.fileArr = $P.fileArr.filter((element) => keys.indexOf(element.id) === -1);
$P.fnDisplay();
}
});

Loading…
Cancel
Save