流星错误:无此功能:仅在生产模式下

问题描述 投票:0回答:1

我的应用程序在调试模式下运行完美,但是在生产模式下运行时,我得到:

错误:无此类功能:canAddMore

这是我拥有的JS代码:

Template.fbRegister.helpers({
    jobCount: function() {
        return Session.get("jobCount");
    },

    eduCount: function() {
        return Session.get("eduCount");
    },

    moreThanOneJob: function() {
        return Session.get('jobCount').length > 1
    },

    moreThanOneEdu: function() {
        return Session.get('eduCount').length > 1
    },

    canAddMore: function(count) {
        console.log(count)
        return count.length <= 2
    },
});

这是HTML代码:

{{#if canAddMore jobCount}}<a class="normal-link add-job">+ Add another Job</a>{{/if}}

我在这里做错了什么?

javascript jquery meteor
1个回答
0
投票

由于缺少几个分号 ,您的代码可能会中断生产。 部署Meteor应用程序时,您的代码将被缩小 。 在此过程中,空白行将被删除,因此不再可能区分语句何时结束。

请试试:

Template.fbRegister.helpers({
    jobCount: function () {
        return Session.get("jobCount");
    },
    eduCount: function () {
        return Session.get("eduCount");
    },
    moreThanOneJob: function () {
        return Session.get('jobCount').length > 1;
    },
    moreThanOneEdu: function () {
        return Session.get('eduCount').length > 1;
    },
    canAddMore: function (count) {
        console.log(count);
        return count.length <= 2;
    }
});
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.