修复无刷新忘记更新的bug

This commit is contained in:
cxykevin 2024-08-12 06:26:41 +08:00
parent c866e5f47a
commit 6f2a135b4b
1 changed files with 2 additions and 0 deletions

View File

@ -40,11 +40,13 @@ function changePage(url) {
var old_tag = document.getElementsByClassName("mdui-prose")[0]; var old_tag = document.getElementsByClassName("mdui-prose")[0];
var old_topbar_tag = document.getElementsByClassName("topbar")[0]; var old_topbar_tag = document.getElementsByClassName("topbar")[0];
var old_navcard_tag = document.getElementById("navcard");
var virtualtag = document.createElement('div'); var virtualtag = document.createElement('div');
virtualtag.insertAdjacentHTML('beforeend', xhr.responseText); virtualtag.insertAdjacentHTML('beforeend', xhr.responseText);
var title = virtualtag.getElementsByTagName("title")[0].innerText; var title = virtualtag.getElementsByTagName("title")[0].innerText;
old_tag.innerHTML = virtualtag.getElementsByClassName("mdui-prose")[0].innerHTML; old_tag.innerHTML = virtualtag.getElementsByClassName("mdui-prose")[0].innerHTML;
old_topbar_tag.innerHTML = virtualtag.getElementsByClassName("topbar")[0].innerHTML; old_topbar_tag.innerHTML = virtualtag.getElementsByClassName("topbar")[0].innerHTML;
old_navcard_tag.innerHTML = document.getElementById("navcard").innerHTML;
var elements = document.querySelectorAll('[active]'); var elements = document.querySelectorAll('[active]');
elements.forEach(element => { elements.forEach(element => {