在 Tailwind CSS 中使用基于类的深色模式和 Next.js v12 时,如何防止页面闪烁,而不使用任何 3rd 方 pkg(例如 next-themes)?
我看过:
Do not add <script> tags using next/head (see inline <script>). Use next/script instead. See more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component<Script strategy="beforeInteractive" src="/scripts/darkMode.js"/>仍然会导致页面闪烁,因为它添加defer到了head// On page load or when changing themes, best to add inline in `head` to avoid FOUC
if (localStorage.theme === …Run Code Online (Sandbox Code Playgroud) 确定当前给定语言环境的短日期格式的最佳方法是什么?
例如,如果我的脚本的语言环境设置为荷兰语,我想以某种方式获取在该特定语言环境中使用的短日期格式,它将是:
DD-MM-YYYY
如果它设置为American,我想在美国语言环境中获取日期格式:
毫米/日/年
等等...