【问题标题】:Uncaught RangeError: Maximum call stack size exceeded in meteor autoform未捕获的 RangeError:流星自动生成中超出了最大调用堆栈大小
【发布时间】:2015-07-01 19:04:10
【问题描述】:

这是一个非常简单的应用程序。我不知道为什么会收到“未捕获的 RangeError:超出最大调用堆栈大小”。

在名为“both”的文件夹中,我有一个 JS 文件,其架构定义如下

Schema1 = new SimpleSchema({
    name:{
        type:String,
        label:'Name'
    }
});

在客户端文件夹中, 现在我有一个如图所示的 HTML 模板:

<template name="test">
    {{#autoForm schema="Schema1" id = "schema1" type="method-update" meteormethod="processInServer" doc=formDoc}}
        {{> afQuickField name='name'}}
        <button type="insert">Update</button>
    {{/autoForm}}
</template>

上述模板的helpers如下:

Template.test.helpers({
    formDoc:function(){
        return 'avishek';
    }
})

var hook = {
    before:{
        method:function(doc){
            console.log(doc);
            return doc;
        }
    }
}

AutoForm.addHooks(['schema1'],hook);

在服务器文件夹中,

Meteor.methods({
    'processInServer': function () {
        console.log('called server');
        return 'success';
    }
})

此应用程序可能出现什么问题。除了这个,我什么都没有。

【问题讨论】:

  • 把你的助手改成 formDoc:function() { return { name: 'avishek'; } } 试试?

标签: javascript meteor meteor-autoform


【解决方案1】:

我明白了,伙计们。助手必须有 _id 属性

Template.test.helpers({
    formDoc:function(){
        return {'_id':'acbde1222','name':'avishek'};
    }
})

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-04-12
    • 2018-01-24
    • 2014-08-01
    • 2015-10-28
    • 2013-05-17
    相关资源
    最近更新 更多