formkit-core-skilld
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseformkit/formkit @formkit/core
@formkit/coreformkit/formkit @formkit/core
@formkit/coreVersion: 1.7.2 (Dec 2025)
Deps: @formkit/utils@^1.7.2
Tags: perf: 1.0.0-beta.13-c578106 (Nov 2022), dev: 1.7.1-dev.3466e73 (Dec 2025), latest: 1.7.2 (Dec 2025), next: 1.7.2-next.296355 (Dec 2025)
References: Docs — API reference, guides • GitHub Issues — bugs, workarounds, edge cases • GitHub Discussions — Q&A, patterns, recipes • Releases — changelog, breaking changes, new APIs
**版本:**1.7.2(2025年12月)
依赖:@formkit/utils@^1.7.2
**标签:**perf: 1.0.0-beta.13-c578106(2022年11月),dev: 1.7.1-dev.3466e73(2025年12月),latest: 1.7.2(2025年12月),next: 1.7.2-next.296355(2025年12月)
参考链接:文档 — API参考、指南 • GitHub问题 — bug、解决方案、边缘案例 • GitHub讨论 — 问答、模式、实践方案 • 版本发布 — 更新日志、重大变更、新API
API Changes
API变更
This section documents version-specific API changes — prioritize recent major/minor releases.
-
NEW:— v1.6.0, access parent context with optional effect callback source
useFormKitContext() -
NEW:— v1.6.0, access any context by its explicit id source
useFormKitContextById() -
NEW:— v1.6.0, access any node by its explicit id source
useFormKitNodeById() -
NEW:— v1.6.0, de-registers receipts from the
stopWatch()function sourcewatchRegistry -
NEW:prop — v1.6.0, adds additional components to the input schema for sections-schema source
library -
NEW:— v1.5.0, third argument
createInputallows extending default sections sourcesectionsSchema -
NEW:/
didMount— v1.5.0, context property and node event to detect DOM mounting sourcemounted -
NEW:— v1.5.0, globally change locale for all forms across multiple APIs source
changeLocale() -
NEW:— v1.7.0, compare date against another field; also
date_after_nodesourcedate_before_node -
NEW:state — v1.6.3,
passingindicates if input satisfies validation rules sourcecontext.state.passing -
NEW:— v1.7.0, prop for auto-height textarea addon to respect CSS min-height source
minAutoHeight -
BREAKING:— v1.6.0, Vue is now a peer dependency to avoid multiple instance issues source
@formkit/vue -
DEPRECATED: Genesis CSS theme — v1.5.0, marked as legacy; use Tailwind themes instead source
-
NEW:(experimental) — v1.6.1, syncs two nodes of same name in same parent (experimental) source
mergeStrategy
Also changed: generic v1.6.0 · Boolean props shorthand v1.5.0 · i18n v1.7.0 · reactivity v1.5.0 · inference v1.6.0 · peer deps removed v1.7.1
getNode<T>()summaryHeadernode.childrenFormKitTypeDefinitionthemes本部分记录特定版本的API变更——优先查看近期的主版本/次版本更新。
-
新增:— v1.6.0版本,可通过可选的effect回调访问父级上下文 来源
useFormKitContext() -
新增:— v1.6.0版本,可通过明确的id访问任意上下文 来源
useFormKitContextById() -
新增:— v1.6.0版本,可通过明确的id访问任意节点 来源
useFormKitNodeById() -
新增:— v1.6.0版本,从
stopWatch()函数中注销回执 来源watchRegistry -
新增:属性 — v1.6.0版本,为sections-schema的输入架构添加额外组件 来源
library -
新增:— v1.5.0版本,第三个参数
createInput允许扩展默认区块 来源sectionsSchema -
新增:/
didMount— v1.5.0版本,用于检测DOM挂载的上下文属性和节点事件 来源mounted -
新增:— v1.5.0版本,通过多个API全局更改所有表单的语言环境 来源
changeLocale() -
新增:— v1.7.0版本,将日期与另一个字段进行比较;同时新增
date_after_node来源date_before_node -
新增:状态 — v1.6.3版本,
passing表示输入是否满足验证规则 来源context.state.passing -
新增:— v1.7.0版本,自动高度文本框插件的属性,用于遵循CSS最小高度设置 来源
minAutoHeight -
重大变更:— v1.6.0版本,Vue现在是peer依赖,以避免多实例问题 来源
@formkit/vue -
已废弃:Genesis CSS主题 — v1.5.0版本,标记为遗留主题;请改用Tailwind主题 来源
-
新增:(实验性) — v1.6.1版本,同步同一父级下同名的两个节点(实验性) 来源
mergeStrategy
其他变更:泛型 v1.6.0 · 布尔属性简写 v1.5.0 · 国际化 v1.7.0 · 响应式 v1.5.0 · 类型推断 v1.6.0 · peer依赖移除 v1.7.1
getNode<T>()summaryHeadernode.childrenFormKitTypeDefinitionthemesBest Practices
最佳实践
-
Read resolved configuration and prop data fromrather than
node.props— explicit props and parent configurations are automatically merged into the props object sourcenode.config -
Synchronize multiple inputs with the same name at the same level using theconfig option — prevents value conflicts when identical names are required by template structure source
mergeStrategy -
Useinstead of direct assignment to
node.input(value)— ensures the tree's state is tracked and triggers the asynchronous settlement process sourcenode.value -
Awaitbefore programmatically reading form values or submitting — guarantees all asynchronous input commits and side effects are complete source
node.settled -
Appendto event names in
.deepto capture events bubbling from descendants — allows parent nodes or plugins to respond to subtree lifecycle changes sourcenode.on() -
Leverageto create reactive, tree-wide counters for messages — efficiently sums message states (like errors or visibility) across complex form structures source
node.ledger -
Traverse the node tree usingwith special tokens like
node.at(),$root, and$parent— provides a robust way to access relative nodes without hardcoding absolute paths source$self -
Opt out ofin production to enable tree-shaking for unused rules, inputs, and locales — significantly reduces bundle size by manually registering only required features source
defaultConfig -
Register middleware viawithin plugins to intercept core operations — enables reusable logic for transforming props, values, or error messages across multiple forms source
node.hook -
Always remove event listeners using the "receipt" returned byvia
node.on()— prevents memory leaks and redundant execution in long-lived or dynamic form contexts sourcenode.off(receipt)
-
从而非
node.props中读取已解析的配置和属性数据——显式属性和父级配置会自动合并到props对象中 来源node.config -
使用配置选项同步同一层级下同名的多个输入框——当模板结构要求使用相同名称时,可防止值冲突 来源
mergeStrategy -
使用而非直接赋值给
node.input(value)——确保树状状态被跟踪,并触发异步结算流程 来源node.value -
在以编程方式读取表单值或提交前,等待完成——保证所有异步输入提交和副作用都已完成 来源
node.settled -
在中的事件名称后追加
node.on(),以捕获来自后代节点的冒泡事件——允许父节点或插件响应子树的生命周期变化 来源.deep -
利用创建响应式的树状全局消息计数器——高效汇总复杂表单结构中的消息状态(如错误或可见性) 来源
node.ledger -
使用带有、
$root和$parent等特殊标记的$self遍历节点树——无需硬编码绝对路径,即可可靠地访问相对节点 来源node.at() -
在生产环境中禁用,以对未使用的规则、输入框和语言环境启用摇树优化——通过手动仅注册所需功能,显著减小包体积 来源
defaultConfig -
在插件中通过注册中间件,以拦截核心操作——可实现跨多个表单的属性、值或错误消息转换的可复用逻辑 来源
node.hook -
务必使用返回的“回执”,通过
node.on()移除事件监听器——防止在长期运行或动态表单环境中出现内存泄漏和重复执行 来源node.off(receipt)