also change meta tag theme-color

This commit is contained in:
LouisLam
2021-08-13 00:23:40 +08:00
parent d39b43dacc
commit 37f1d60f82
2 changed files with 17 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ export default {
}
document.body.classList.add(this.theme);
this.updateThemeColorMeta();
},
computed: {
@@ -33,6 +34,17 @@ export default {
theme(to, from) {
document.body.classList.remove(from);
document.body.classList.add(this.theme);
this.updateThemeColorMeta();
}
},
methods: {
updateThemeColorMeta() {
if (this.theme === "dark") {
document.querySelector("#theme-color").setAttribute("content", "#161B22");
} else {
document.querySelector("#theme-color").setAttribute("content", "#5cdd8b");
}
}
}
}