Skip to content

Instantly share code, notes, and snippets.

View guxuerui's full-sized avatar

Gu Xuerui guxuerui

View GitHub Profile
@guxuerui
guxuerui / MyPick.ts
Created August 11, 2023 14:36
手动实现TS泛型Pick方法
type MyPick<T, K extends keyof T> = {
[key in K]: T[key]
}
@guxuerui
guxuerui / ToggleTheme.svelte
Created March 19, 2025 10:40
在Svelte项目中,使用Css View Transition API实现切换主题颜色及动画效果
<script lang="ts">
import { onMount, tick } from "svelte";
$: currentTheme = "";
function setTheme() {
if (currentTheme === "light" || currentTheme === "auto") {
localStorage.setItem("color-schema", "dark");
document.documentElement.classList.add("dark");
} else {