0

スクリプトがテンプレートをレンダリングしようとすると、Uncaught ReferenceError: x is not defined エラーが発生し続けます。このスクリプトは、backbone.js、require.js、underscore.js、および jquery.js の組み合わせを使用しています。オンラインで回答をデバッグして検索するのに1日を費やしました。何が起こっているのか誰か知っていますか?

コード:

define([
    'jQuery',
    'Underscore',
    'Backbone',
    'text!templates/sharingFactory.html'
], function($, _, Backbone, SharingFactoryTemplate) {
    console.log('in SharingFactoryItemView');
    var SharingFactoryItemView = Backbone.View.extend({
        tagName: "span",
        initialize: function() {
            console.log('in initialize');
            this.template = _.template(SharingFactoryTemplate);
            console.log(this);
            this.render();
        },
        render: function () {
            console.log('in render');
            var data = this.model.toJSON();
            console.log(data);
            this.$el.html(this.template(data));
            return this;
        }
    });

    return SharingFactoryItemView; 
});

コンソール ログ:

in initialize SharingFactoryItemView.js:14
child
 SharingFactoryItemView.js:16
in render SharingFactoryItemView.js:20
Object
 SharingFactoryItemView.js:22
Uncaught ReferenceError: x is not defined
4

0 に答える 0