docs: 处理移动端HTML报错 (#5536)

This commit is contained in:
RUNZE LU 2022-10-13 11:34:28 +08:00 committed by GitHub
parent 925239b543
commit 67f839d18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,13 @@
if (theme == 'default') {
theme = 'cxd';
}
document.querySelector(`link[title=${theme}]`).disabled = false;
const linkDom = document.querySelector(`link[title=${theme}]`);
if (linkDom) {
linkDom.disabled = false;
}
if (theme === 'dark') {
document.querySelector('body').classList.add('dark');
}