【问题标题】:How to show username field in keystonejs Admin UI during add/edit user?如何在添加/编辑用户期间在 keystonejs 管理 UI 中显示用户名字段?
【发布时间】:2016-08-27 05:25:39
【问题描述】:

我想在添加/编辑用户期间在 keystonejs 的管理 UI 中显示用户名。我在用户模型中添加了用户名和其他字段,如下所示,但它们没有显示在管理 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} });

请帮忙。谢谢

【问题讨论】:

    标签: node.js keystonejs


    【解决方案1】:

    在创建 UX 屏幕中为您想要的字段添加一个“initial: true”参数 ...

    User.add({
      username: {
        type: String,
        required: true, 
        unique: true,
        index: true,
        default: '',
        initial: true
      },...
    });
    

    【讨论】:

      猜你喜欢
      • 2012-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-14
      • 1970-01-01
      • 2021-03-07
      • 2021-08-31
      相关资源
      最近更新 更多