我想在添加/编辑用户期间在keystonejs的管理界面中显示用户名。我在User模型中添加了用户名和其他fiedl,如下所示,但它们没有显示在Admin UI中。
User.add({
username: {type: String, required: true, unique: true, index: true, default: ''},
name: {type: Types.Name, required: true, index: true},
email: {type: Types.Email, initial: true, required: true, index: true},
password: {type: Types.Password, initial: true, required: true},
resetPasswordKey: {type: String, hidden: true},
homeawayAccessToken:{type: String, hidden: true, default: ''},
homeawayRefreshToken:{type: String, hidden: true, default: ''},
homeawayTokenExpiresIn:{type: Number, hidden: true, default: ''}
}, 'Permissions', {
isAdmin: {type: Boolean, label: 'Can access Keystone', index: true}
});
请帮忙。感谢
答案 0 :(得分:0)
在create UX屏幕中为所需字段添加'initial:true'参数 ...
User.add({
username: {
type: String,
required: true,
unique: true,
index: true,
default: '',
initial: true
},...
});