feat: 拆解单文件 Demo 为 Vite + React 前端工程
- 保留根目录 index.html 作为 v1 单文件原型(不参与构建) - app/ 下新建 Vite + React 工程(vite.config root 指向 app/,两版互不干扰) - 状态收敛到 useAppStore(表单/消息/串行确认/一键发品 + 4 条异步编排流) - 生成卡片重构为结构化数据驱动渲染,按钮为真实 React 事件 - 6 大表单模块卡片化;Agent 意图解析与偏好学习抽为独立 lib - 功能与视觉与 v1 完全一致,浏览器端全流程回归通过
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { createContext, useContext } from 'react'
|
||||
|
||||
/** 全局 Store 上下文:App 中用 useAppStore() 创建并注入 */
|
||||
export const StoreContext = createContext(null)
|
||||
|
||||
export function useStore() {
|
||||
const store = useContext(StoreContext)
|
||||
if (!store) throw new Error('useStore 必须在 <StoreContext.Provider> 内使用')
|
||||
return store
|
||||
}
|
||||
Reference in New Issue
Block a user