diff --git a/templates/tag.html b/templates/tag.html index 6a7d031..f859062 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -69,6 +69,7 @@ document.getElementById("{{ blogBase['singeListJson'][num]['postTitle'] }}").set {%- endfor %} tagList=[]; +jsonData=''; let requestJson="blogBase.json" let request=new XMLHttpRequest(); request.open("GET",requestJson); @@ -77,10 +78,10 @@ request.send(); request.onload=function(){ jsonData=JSON.parse(request.response); console.log(jsonData); - showList(jsonData,window.location.hash.slice(1)); + showList(window.location.hash.slice(1)); } -function showList(jsonData,tag){ +function showList(tag){ let SideNav=document.getElementsByClassName("SideNav")[0]; let tagLable=document.getElementById("tagLable"); for(i in jsonData["postListJson"]){ @@ -140,9 +141,9 @@ function showList(jsonData,tag){ function updateShowTag(label){ if(window.location.hash.slice(1)!=encodeURI(label)){ window.location.hash="#"+(label); - showList(jsonData,label); + showList(label); + console.log("change to "+label); } - }