Backbone.js的不可访问对象属性 [英] Backbone.js inaccessible object attributes

查看:301
本文介绍了Backbone.js的不可访问对象属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我真的不能COM prehend ...我不知道,如果骨干网做一些巫术对这些对象的一个​​问题,但我似乎无法得到他们甚至原始访问。

I'm having a problem that I really can't comprehend… I'm not sure if backbone is doing some voodoo to these objects but I can't seem to get even raw access to them.

我的基本问题是,有时当我加载页面,获取模型和渲染视图中的一个集合将只显示/渲染时间的50%。我以为这是一个问题被与填充模式,但经过一番调查,我能看到的是填充模型,但不可访问。

My basic problem is, sometimes when I load the page, fetch the models and render the views one collection will only show/render 50% of the time. I assumed this was an issue with the model not being populated but after some investigation, I could see the model was populated but not accessable.

有没有人有什么想法?我重视工作和不工作,以说明我的观点(理智)的一些截图。

Does anyone have any ideas? I have attached a few screenshots of working and not working to illustrate my point(sanity).

页面装载精 - 模型访问

Page loading fine - model accessed

网页无法正确加载 - 模型无法访问

Page not loading correctly - model inaccessible

对象时的的正确加载

The object when is loading correctly

对象时的的正确加载

The object when not loading correctly

推荐答案

您调试尝试去错了。

console.dir是很多更复杂的那么。它向您展示一个活对象,而不是实际的对象。

console.dir is a lot more complex then that. it shows you a live object, not the real object.

如果您尝试登录 $。扩展(真{} OBJ)(或其他一些克隆),那么你可以登录真正的对象。

If you try to log $.extend(true, {}, obj) (or some other clone) then you can log the real object.

正如前面提到的这听起来像一个ajax的事情。是你想用它它加载之前? (但有时你得到幸运,它已经被再装)。

As mentioned it sounds like an ajax thing. Are you trying to use it before it has loaded? (But sometimes you get lucky and it has loaded by then).

我们需要更多的信息。一个的jsfiddle将是最好的。

We need more information. A jsfiddle would be the best.

这篇关于Backbone.js的不可访问对象属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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