安装
在一个已有的 React 18/19 项目里(Vite、Next.js、Create React App 等):
bash
npm install @caoergou/windows-xp react react-dom styled-componentsreact、react-dom、styled-components(v6)是对等依赖。其余实现细节 (react-draggable、react-resizable、i18next、react-i18next、immer) 都是普通依赖,会自动安装;XP 主题样式已编译进 style.css,无需额外安装。
快速开始
jsx
import { WindowsXP } from '@caoergou/windows-xp';
import '@caoergou/windows-xp/style.css';
function App() {
// 开发时 autoLogin 和 skipBoot 直接跳到桌面;去掉它们可看到开机和登录。
return <WindowsXP autoLogin skipBoot />;
}不加 autoLogin/skipBoot 就是完整体验:开机画面 → 登录(默认用户 User, 密码 forthe2000s)→ 桌面。