根据daisyUI documentation,我们可以通过在<html>
中更新data-theme
变量的值来更新主题,如下所示:<html data-theme="cupcake"></html>
通过查看Custom Document的nextjs文档,我不知道如何动态更新data-theme
根据daisyUI documentation,我们可以通过在<html>
中更新data-theme
变量的值来更新主题,如下所示:<html data-theme="cupcake"></html>
通过查看Custom Document的nextjs文档,我不知道如何动态更新data-theme
1条答案
按热度按时间bxpogfeg1#
我们可以在npm包next-themes的帮助下,在nextjs中更新
<html>
标签上的data-theme
变量,如下所示:Next-themes在执行
setTheme('value')
函数时默认更改<html>
标记上的data-theme
的值