监听hash变化刷新页面

This commit is contained in:
Meekdai 2023-11-21 22:12:49 +08:00
parent 6280f10b12
commit d970382ebb

View File

@ -92,7 +92,7 @@ function showList(jsonData){
showLabels.setAttribute("class","Label"); showLabels.setAttribute("class","Label");
showLabels.setAttribute("style","background-color:"+jsonData["postListJson"][i]['labelColor']); showLabels.setAttribute("style","background-color:"+jsonData["postListJson"][i]['labelColor']);
showLabels.innerHTML=jsonData["postListJson"][i]['label']; showLabels.innerHTML=jsonData["postListJson"][i]['label'];
showLabels.setAttribute("href",'/tag.html#'+jsonData["postListJson"][i]['label']); showLabels.setAttribute("href",'#'+jsonData["postListJson"][i]['label']);
tagLable.appendChild(showLabels); tagLable.appendChild(showLabels);
} }
@ -137,5 +137,8 @@ function showList(jsonData){
} }
} }
} }
window.onhashchange=function(event){location.reload();}
</script> </script>
{% endblock %} {% endblock %}