使用ian:accounts-ui-bootstrap-3 profile.first-name返回NaN虽然它显示在控制台中填充

时间:2015-06-26 02:48:12

标签: javascript jquery twitter-bootstrap meteor meteor-accounts

我正在使用ian:accounts-ui-bootstrap-3在Meteor中以我的登录形式创建其他字段。这些字段正在填充。当我检查JS控制台中的字段时,我看到我的名字和姓氏已填充,但当我尝试检索它们时,它们返回NaN。

我的registration.js

Accounts.ui.config({
requestPermissions: {},
extraSignupFields: [{
    fieldName: 'first-name',
    fieldLabel: 'First name',
    inputType: 'text',
    visible: true,
    validate: function(value, errorFunction) {
      if (!value) {
        errorFunction("Please write your first name");
        return false;
      } else {
        return true;
      }
    }
}, {
    fieldName: 'last-name',
    fieldLabel: 'Last name',
    inputType: 'text',
    visible: true,
}, {
    fieldName: 'gender', 
    showFieldLabel: false,      // If true, fieldLabel will be shown before radio group
    fieldLabel: 'Gender',
    inputType: 'radio',
    radioLayout: 'vertical',    // It can be 'inline' or 'vertical'
    data: [{                    // Array of radio options, all properties are required
        id: 1,                  // id suffix of the radio element
        label: 'Male',          // label for the radio element
        value: 'm'              // value of the radio element, this will be saved. 
      }, {
        id: 2,
        label: 'Female',
        value: 'f',
        checked: 'checked'
    }], 
    visible: true
}]
});

onlineUsers.js

Meteor.publish("online", function(){
  return Meteor.users.find({"status.online" : true});
});

输出

Meteor.users.findOne({"status.online": true}).profile
Object {first-name: "tarun", last-name: "", gender: "m"}
Meteor.users.findOne({"status.online": true}).profile.gender
"m"
Meteor.users.findOne({"status.online": true}).profile.first-name
NaN

任何人都可以帮忙吗?

0 个答案:

没有答案