MarionetteJS CompositeView中的怪异的行为 [英] weird behavior of MarionetteJS compositeView

查看:164
本文介绍了MarionetteJS CompositeView中的怪异的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与MarionetteJS CompositeView中的工作。

I am working with MarionetteJS compositeView.

出于某种原因,我得到一个递归模板的行为。

For some reason i am getting a recursive template behavior.

通常ItemView控件的模板的itemViewContainer内渲染,但由于某些原因,而不是采取ItemView控件的模板,它需要它自己的CompositeView中的模板。

Usually the itemView's template is rendered within the itemViewContainer but for some reason instead of taking the itemView's template it takes it's own compositeView template.

这不是英语,但行为可以直观看到这里:

it's not english but the behavior can be visually seen here:

的http://www.$c$cforum.me/admin.html

另一件事是,我有它完美的工作在我的本地主机,但我把它上传并尝试从我的托管服务器上运行它的那一刻就显示了这个怪异的行为。

Another thing is, I have it working perfectly on my localhost but the moment i upload it and try to run it from my hosting server it shows this weird behavior.

任何想法?

推荐答案

这发生在木偶找不到你ItemView控件。例如,如果你指定在你真正定义它的ItemView控件,它不会被发现。当你不指定ItemView控件(或其未找到),默认行为踢,这是使用相同的CompositeView中的ItemView控件,创建一个递归树结构。

This happens when marionette can't find your itemView. For example, if you specify the itemView before you actually define it, it won't be found. When you don't specify an itemView ( or its not found), the default behavior kicks in, which is to use the same compositeView as the itemView, to create a recursive tree structure.

要解决这个问题,在CompositeView中的声明中使用它之前定义ItemView控件。

To fix this, define the itemView before using it in the compositeView declaration.


IV = Marionette.ItemView.extend({ /* ... */ });

CV = Marionette.CompositeView.extend({
  itemView: IV,
  // ...
});

这篇关于MarionetteJS CompositeView中的怪异的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆