我想使我的Keystone列表對象只有在對象未發佈時纔可編輯。這裏是我的降低列表定義:根據字段值設置關鍵字列表「noedit」?
var Campaign = new keystone.List('Campaign', {
nodelete: true,
track: {
createdAt: true,
},
});
Campaign.add({
...,
publish: {
type: Types.Boolean,
required: false,
initial: false,
dependsOn: {
publishedOn: '',
},
},
publishedOn: {
type: Types.Datetime,
label: 'Published On',
hidden: true,
},
});
是否有可能設置noedit
只有publishedOn
不爲空?我試圖防止對象在「發佈」之後被修改,並且我將簡要介紹示例。