Sencha touch 2 触发事件时,Sencha Touch会在密码字段中显示用户键入的密码

Sencha touch 2 触发事件时,Sencha Touch会在密码字段中显示用户键入的密码,sencha-touch-2,Sencha Touch 2,在Sencha Touch视图配置中,我有一个psswordfield: { // Password. xtype: 'passwordfield', placeHolder: 'Password', itemId: 'registerViewPasswordField', } 我已经委托了一个事件,用户可以检查他是否想要查看密码 listeners: [ { delegate: '#registerViewShowPassword',

在Sencha Touch视图配置中,我有一个psswordfield:

{
    // Password.
    xtype: 'passwordfield',
    placeHolder: 'Password',
    itemId: 'registerViewPasswordField',
}
我已经委托了一个事件,用户可以检查他是否想要查看密码

listeners: [
   {
        delegate: '#registerViewShowPassword',
        event: 'check',
        fn: 'onRegisterViewShowPasswordCheck'
    },{
        delegate: '#registerViewShowPassword',
        event: 'uncheck',
        fn: 'onRegisterViewShowPasswordUncheck'
    }
]
如果用户单击以显示密码,如何将密码字段转换为文本字段,如何显示用户输入的实际密码

onRegisterViewShowPasswordCheck: function() {
    // how can I make the "passwordfield" show the password the user just typed?
}

Ty

您可以在密码字段下添加文本字段,并在默认情况下将其隐藏,然后在需要时隐藏密码字段并显示常规字段

{
    // Password.
    xtype: 'passwordfield',
    placeHolder: 'Password',
    itemId: 'registerViewPasswordField'
},
{
    // Visible password.
    xtype: 'textfield',
    placeHolder: 'Password',
        hidden: true,
    itemId: 'registerVisiblePasswordField'
}
然后在onRegisterViewShowPasswordCheck方法中,切换两个字段的可见性