mcpField
R
reflex-docs

reflex-docs

github.com/reflex-dev开发20728 次安装20 周前更新
代码仓库

关于 reflex-docs

reflex-docs 是面向 Reflex 开发者的文档技能,涵盖使用 Python 构建全栈 Web 应用的参考资料。它按主题整理框架概念与 API 文档,便于查阅。

主要功能

  1. 01Reflex 入门与框架参考
  2. 02状态、变量、组件与事件
  3. 03页面、路由与样式
  4. 04数据库与身份验证主题
  5. 05API 路由与自定义组件

适用场景

  1. 01实现前查阅 Reflex 文档
  2. 02查询状态与事件模式
  3. 03规划页面、样式或数据库功能

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/reflex-dev/agent-skills --skill reflex-docs

安装后在 Claude Code 中输入/reflex-docs确认已加载。

详细介绍

Reflex 文档

Reflex 是一个开源框架,可使用纯 Python 构建全栈 Web 应用,无需 JavaScript。

关于 Reflex 的训练数据可能已过时。请始终优先参考文档,而不是预训练知识。

参考资料

主题URL
入门https://reflex.dev/docs/getting-started/introduction
组件https://reflex.dev/docs/components/props
状态https://reflex.dev/docs/state/overview
变量https://reflex.dev/docs/vars/base-vars
事件https://reflex.dev/docs/events/events-overview
页面与路由https://reflex.dev/docs/pages/overview
样式https://reflex.dev/docs/styling/overview
数据库https://reflex.dev/docs/database/overview
资源https://reflex.dev/docs/assets/overview
身份验证https://reflex.dev/docs/authentication/authentication-overview
客户端存储https://reflex.dev/docs/client-storage/overview
API 路由https://reflex.dev/docs/api-routes/overview
API 参考https://reflex.dev/docs/api-reference/cli
自定义组件https://reflex.dev/docs/custom-components/overview
封装 Reacthttps://reflex.dev/docs/wrapping-react/overview
组件库https://reflex.dev/docs/library
示例https://reflex.dev/docs/recipes
GitHub 源码(文档)https://github.com/reflex-dev/reflex/tree/main/reflex/docs

核心概念

状态与变量
  • 状态(rx.State):保存应用状态的服务端 Python 类。将变量定义为类属性,将事件处理程序定义为方法。
  • 基础变量:State 上带类型的类属性(count: int = 0)
  • 计算变量:使用 @rx.var 装饰器派生的值
  • 变量操作:无需事件处理程序即可在组件中转换变量
组件
  • 所有 UI 均由 rx.* 组件构建(React 的 Python 封装)
  • 组件接受 属性,并可组合或嵌套
  • 使用 rx.cond() 进行条件渲染,使用 rx.foreach() 进行迭代
事件
  • 事件处理程序:State 上由 @rx.event 装饰的方法
  • 事件触发器:on_click、on_change 等组件属性
  • 事件链:从处理程序返回多个事件
  • 设置器:为每个基础变量自动生成 set_<var> 事件处理程序
页面与路由
  • 页面是由 rx.page 装饰的函数,或通过 app.add_page() 添加的函数
  • 使用方括号语法创建动态路由:[slug]
样式
  • 内联属性、Tailwind CSS、主题设置、响应式设计
  • 使用 rx.theme() 进行全局主题设置
数据库
  • 内置 SQLModel 集成,用于数据库表
  • 定义模型、运行查询并设置关系

评论

支持 Markdown