【发布时间】:2020-05-08 02:38:02
【问题描述】:
基本上就像标题所说的那样——我们正在开展一个项目,我们希望能够根据其他字段的值显示和隐藏各种字段。这似乎是possible in KeystoneJS 4,但我在 KeystoneJS 5 中没有提到它。
【问题讨论】:
标签: keystonejs
基本上就像标题所说的那样——我们正在开展一个项目,我们希望能够根据其他字段的值显示和隐藏各种字段。这似乎是possible in KeystoneJS 4,但我在 KeystoneJS 5 中没有提到它。
【问题讨论】:
标签: keystonejs
dependsOn keystoneJs v4 的功能尚未进入最新的 KeystoneJs 迭代。 v5(我们称之为)完全重写,没有 v4 的许多功能。
但是有一个Pull Request 可能会添加此功能,但不幸的是,这不是核心团队的优先事项,他们还没有在 PR 上做出回应。
一旦 PR 被合并,你就可以做这样的事情
keystone.createList('Test field', {
fields: {
price: { type: Decimal, symbol: '$' },
currency: { type: Text, dependsOn: { $lt: { price: 3 } } },
hero: { type: File, adapter: fileAdapter, dependsOn: { $gt: { price: 3 } } },
markdownValue: { type: Markdown, dependsOn: { $gt: { price: 6 } } },
fortyTwo: {
type: Virtual,
graphQLReturnType: `Int`,
resolver: () => 42,
},
}});
【讨论】: