【问题标题】:Meteor - Autoform with Meteor.users collectionMeteor - 使用 Meteor.users 集合自动生成
【发布时间】:2015-05-22 00:14:48
【问题描述】:

使用 Autoform 和 Meteor.users 创建一个小测试。如果我创建自己的收藏,那很好。但不知何故,我不断收到这个错误,我不知道出了什么问题..

错误:

Uncaught RangeError: Maximum call stack size exceeded
14autoform-inputs.js:162 Uncaught TypeError: Cannot read property 'formValues' of undefined

模板:

    {{> loginButtons}}

    <div class="container">
        <h2>update</h2>
        {{> update }}
    </div>  
</body>

<template name="update">
  {{> quickForm collection="Meteor.users" 
                id="update-user-profile" 
                type="update" 
                doc="user"
            }}
</template>

使用助手返回当前用户的方案:

Meteor.users.attachSchema(new SimpleSchema({
    country: {
        type: String,
        label: "Country"
    },
    city: {
        type: String,
        label: "city"
    },
    email: {
        type: String,
        label: "email"
    },
    story: {
        type: String,
        label: "your story",
        optional: true,
        max: 1000
    }
}));

if (Meteor.isClient) {

    Template.update.helpers({
        user: function(){
            return Meteor.userId();
        }
    });    
}

【问题讨论】:

    标签: meteor meteor-autoform


    【解决方案1】:

    您只需要删除用户的引号

    doc="user" 更改为doc=user

    您的模板应如下所示

    <template name="update">
      {{> quickForm collection="Meteor.users" 
                    id="update-user-profile" 
                    type="update" 
                    doc=user
                }}
    </template>
    

    看看这个MeteorPad

    【讨论】:

    • 嘿,感谢您的回答和链接,但我没有看到 MEteorPad 中运行的工作版本,实际上我什么也没看到并且刷新(浏览器或垫本身)不起作用。你确定这是正确的吗?或者我在这里做错了什么
    猜你喜欢
    • 1970-01-01
    • 2016-04-25
    • 1970-01-01
    • 2014-10-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-11
    • 2015-05-10
    • 1970-01-01
    相关资源
    最近更新 更多