gpt4 book ai didi

node.js - keystonejs 根据选择另一个选择选项显示选择选项

转载 作者:太空宇宙 更新时间:2023-11-04 00:15:54 25 4
gpt4 key购买 nike

我正在尝试在 keystone.js 应用程序模型中从选择选项中选择与用户在另一个选择选项中选择的内容相关的内容。所以他将从第一个选择中进行选择,第二个选择选项应该具有仅与第一个选择的选项相关的数据..我希望有一个人可以帮助我非常感谢

最佳答案

您应该使用dependsOn选项。

示例..

type: { type: Types.Select, options: ['TypeOne','TypeTwo','TypeThree TypeFour' ], initial: true },

something: { type: Types.Text, dependsOn: { type: 'TypeThree' }, initial: true },

关系示例 - 您可以遵循这样的逻辑,即仅当与 dependentOn 条件匹配时才会显示某些字段。

Adjustment.add({
type: { type: Types.Select, options: ['Booking','Shipment','Warehouse','Inventory' ], initial: true },
sku: { type: Types.Text, initial: true },
quantity: { type: Types.Number, initial: true, width: 'short' },
keyID: { type: Types.Relationship, ref: 'Order', dependsOn: { type: 'Booking' }, initial: true },
bookingID: { type: Types.Relationship, ref: 'Booking', dependsOn: { type: 'Booking' }, initial: true },
warehouse: { type: Types.Relationship, ref: 'Warehouse', dependsOn: { type: 'Warehouse' }, initial: true },
shipmentID: { type: Types.Text, dependsOn: { type: 'Shipment' }, initial: true },

});

关于node.js - keystonejs 根据选择另一个选择选项显示选择选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47015261/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com