跳转到内容

暗黑模式

组件库通过 body 标签上的 sd-theme 属性来标明当前的主题,所以你只要修改这个属性,即可完成主题的切换。

document.body.setAttribute('sd-theme', 'dark');
document.body.removeAttribute('sd-theme');

可参考 暗黑模式颜色