nuxt.js项目js添加内容
function endText() {
var head = document.querySelector(".l-head .head-right");
if (document.querySelector(".l-head .head-share") == null) {
var append = document.createElement("div");
append.setAttribute("class", "head-share");
append.innerHTML =
'新增内容';
head.insertAdjacentElement("afterbegin", append);
}
}
window.onload = function () {
document
.querySelector("header")
.addEventListener("DOMNodeInserted", function (e) {
endText();
});
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
编辑 (opens new window)
上次更新: 2023/03/08, 02:53:55