创新方案
在 Vue 3 / Nuxt 4 项目中集成…
当你用 TailwindCSS v4 + motion-v/GSAP/Three.js 给 Vue 或 Nuxt 项目做动画落地页、Hero 区、3D 可视化、交互式背景与光标特效时,按此流程安装、配置并复制组件。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 49/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 85/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
在 Vue 3 / Nuxt 4 项目中通用
解决思路
- 安装核心依赖:`bun add -d clsx tailwind-merge class-variance-authority tw-animate-css`,再执行 `bun add @vueuse/core motion-v`。
- 按需安装可选依赖:3D 组件(Globe、Cosmic Portal 等)执行 `bun add three @types/three`;WebGL 组件(Fluid Cursor、Neural Background 等)执行 `bun add ogl`。
- 安装前做供应链安全检查:用 `npm config set ignore-scripts true` 禁用 post-install 脚本(Bun 默认禁用);对新版本包等待 7 天冷却期;用 `socket package score npm <pkg>` 或 `socket npm install <pkg>` 审计包,必要时加载 `dependency-upgrade` skill 配置 Socket CLI、冷却期、lockfile 校验与 CI 强制。
- 创建 `lib/utils.ts`,用 `clsx` + `tailwind-merge` 实现 `cn(...inputs: ClassValue[])` 工具函数。
- 在 `main.css` 中配置 CSS 变量,必须包含 `@import "tailwindcss";` 与 `@import "tw-animate-css";`(后者常被遗漏),完整 OkLch 颜色配置参考 `references/SETUP.md`。
- 执行 `./scripts/verify-setup.sh` 验证安装配置是否正确。
- 从 [inspira-ui.com/components](https://inspira-ui.com/components) 浏览并复制所需组件到 `components/ui/` 目录(该库是 copy-paste 模式而非 npm 包)。
- 按效果类型选组件:背景特效→Aurora、Cosmic Portal、Particles、Neural Background;文字动画→Morphing Text、Glitch、Hyper Text、Sparkles Text;3D 可视化→Globe、3D Carousel、Icon Cloud、World Map(需 three);交互光标→Fluid Cursor、Tailed Cursor、Smooth Cursor(WebGL 需 ogl);动画按钮→Shimmer、Ripple、Rainbow、Gradient(无需额外依赖);特殊效果→Confetti、Meteors、Neon Border、Glow Border。
- 需要完整 props、代码与安装细节时,抓取 https://inspira-ui.com/docs/llms-full.txt 这份 LLM 优化文档。
- 编写组件时始终使用基于 interface 的 props:定义 `interface Props` 后 `defineProps<Props>()`,并用 `withDefaults` 设默认值,不要用对象语法 `defineProps({ title: { type: String } })`。
- 即使 Nuxt 有自动导入,也要显式写 import,例如 `import { ref, onMounted, computed } from "vue";` 和 `import { useWindowSize } from "@vueuse/core";`。
- WebGL 组件在 `onUnmounted` 中清理资源:`cancelAnimationFrame(animationFrame)`、`renderer.dispose()`,防止内存泄漏。
- Nuxt 中使用 Three.js 或 WebGL 组件时,用 `<ClientOnly>` 包裹,例如 `<ClientOnly><FluidCursor /></ClientOnly>`,避免 SSR 阶段报错。
- 修复原始文档的可访问性 bug:把 `--destructive-foreground` 改为 `oklch(0.985 0 0)`(原文与 `--destructive` 同色导致文字不可见)。
- 用 `as const` 对象替代 TypeScript enum,例如 `const ButtonVariants = { Primary: "primary" } as const`。
- 按 Pattern 1 组合动画落地页:`<AuroraBackground>` 包裹 `<Motion>`,用 `:initial="{ opacity: 0, y: 40, filter: 'blur(10px)' }"`、`:while-in-view="{ opacity: 1, y: 0, filter: 'blur(0px)' }"`、`:transition="{ delay: 0.3, duration: 0.8, ease: 'easeInOut' }"`,内部放标题与 `<ShimmerButton>`。
适用边界 · 注意事项
- 项目不使用 Vue 3 / Nuxt 4 或 TailwindCSS v4 时(该库的组件与 CSS 变量体系依赖这些栈)。
- 不想以 copy-paste 方式维护组件源码、而希望用传统 npm 组件库统一升级时。
- 无法接受 three/ogl 等大依赖树及对应供应链安全审计成本时。