Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法使用';在';操作员搜索';型号';_Javascript_Backbone.js - Fatal编程技术网

Javascript 无法使用';在';操作员搜索';型号';

Javascript 无法使用';在';操作员搜索';型号';,javascript,backbone.js,Javascript,Backbone.js,同一个物体上有许多问题。但我的有点不同。区别在于,在我的问题中,我没有使用任何主干模型,只使用主干视图 我只使用主干视图。下面是初始化视图时的错误堆栈 Uncaught TypeError: Cannot use 'in' operator to search for 'model' in ace-edit-spec-examples-1-8 (anonymous function) underscore.js:783 _.each._.forEach underscore.js:78 _.pi

同一个物体上有许多问题。但我的有点不同。区别在于,在我的问题中,我没有使用任何主干模型,只使用主干视图

我只使用主干视图。下面是初始化视图时的错误堆栈

Uncaught TypeError: Cannot use 'in' operator to search for 'model' in ace-edit-spec-examples-1-8
(anonymous function) underscore.js:783
_.each._.forEach underscore.js:78
_.pick underscore.js:782
_.extend._configure backbone.js:1086
Backbone.View backbone.js:983
child backbone.js:1529
Backbone.View.extend.render itemview.js:90
Backbone.View.extend.addListItem listview.js:99
Backbone.View.extend.renderList listview.js:84
(anonymous function) listview.js:42
_.each._.forEach underscore.js:78
Backbone.View.extend.render listview.js:41
Backbone.View.extend.render tabview.js:124
(anonymous function) tabview.js:50
collection.fetch.success util.js:28
options.success backbone.js:854
fire jquery.js:1037
self.fireWith jquery.js:1148
done jquery.js:8074
callback 
有什么帮助吗

编辑:

我的看法

var AceEditorView = Backbone.View.extend({
        initialize: function (id,type,here) {
          this.id = id;
          this.type = type;
          this.here = here;
          //this.render();
        }});
我的电话:

new AceEditorView('ace-edit-spec-examples-1-'+json.id,'json',this);
的签名是
新视图([options])
,因此必须将参数作为选项散列传递。试一试

var AceEditorView = Backbone.View.extend({
    initialize: function (opts) {
      this.id = opts.id;
      this.type = opts.type;
      this.here = opts.here;
    }
});
并将其实例化为

new AceEditorView({
    id: 'ace-edit-spec-examples-1-'+json.id,
    type: 'json',
    here: this
});
的签名是
新视图([options])
,因此必须将参数作为选项散列传递。试一试

var AceEditorView = Backbone.View.extend({
    initialize: function (opts) {
      this.id = opts.id;
      this.type = opts.type;
      this.here = opts.here;
    }
});
并将其实例化为

new AceEditorView({
    id: 'ace-edit-spec-examples-1-'+json.id,
    type: 'json',
    here: this
});

请共享视图的代码和创建视图的函数。请共享视图的代码和创建视图的函数。我发现在dev中传递参数不能作为哈希值,但使用require压缩后,我会得到OP提到的错误。我发现在dev中传递参数不能作为哈希值,但是一旦你用require压缩它,我就会得到OP提到的错误。