feat(projects): add switch for customize darkmode transition

This commit is contained in:
Soybean
2023-06-20 22:33:22 +08:00
parent d3ebe95076
commit 6e0cce4d49
7 changed files with 27 additions and 2 deletions

View File

@ -13,6 +13,8 @@ defineOptions({ name: 'DarkModeSwitch' });
interface Props {
/** 暗黑模式 */
dark?: boolean;
/** 自定义暗黑模式动画过渡 */
customizeTransition?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
@ -38,7 +40,7 @@ async function handleSwitch(event: MouseEvent) {
const x = event.clientX;
const y = event.clientY;
if (!document.startViewTransition) {
if (!props.customizeTransition || !document.startViewTransition) {
darkMode.value = !darkMode.value;
return;
}