SC.LabelView.design 不可见
topLeftView: SC.ScrollView.design({
backgroundColor: "#DADFE6",
childViews: 'labLabel labMembersLabel'.w(),
labLabel: SC.SourceListGroupView.design({
layout:{top: 0, left: 0, width: 100, height: 100},
value: "LABORATORY",
fieldLabel: "LAB",
backgroundColor: "white"
}),
labMembersLabel: SC.LabelView.design({
layout: {top: 100, left: 0, width: 100, height: 100},
value: "LAB MEMBERS"
})
}),
labLabel 我们的 LabMembersLabel 都没有出现...我错过了什么?
topLeftView: SC.ScrollView.design({
backgroundColor: "#DADFE6",
childViews: 'labLabel labMembersLabel'.w(),
labLabel: SC.SourceListGroupView.design({
layout:{top: 0, left: 0, width: 100, height: 100},
value: "LABORATORY",
fieldLabel: "LAB",
backgroundColor: "white"
}),
labMembersLabel: SC.LabelView.design({
layout: {top: 100, left: 0, width: 100, height: 100},
value: "LAB MEMBERS"
})
}),
Neither labLabel our LabMembersLabel appears... What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ScrollView 是一个特殊的视图,因为它不使用 childViews 数组,而是期望有一个视图“contentView”,如下所示:
https://github.com/sproutcore/sproutcore/blob/master/frameworks/desktop/views/scroll.js#L42< /a>
使用此视图,它将始终监视高度/宽度,并在 contentView 太大时自动添加滚动条。滚动视图通常用于保存可能会很长的列表视图。
您想要做的是:
如果 contentView 不是 ListView(或控制其自身布局的另一个视图),则提供布局很重要,否则 ScrollView 将无效。
附言。附带说明一下,这不是使用 SC.SourceListGroupView 的方法。这些仅用于在 SC.SourceListView 上设置为“exampleView”。
ScrollView is a special view, in that it does not use the childViews array, but instead expects to have a single view 'contentView' as you can see here:
https://github.com/sproutcore/sproutcore/blob/master/frameworks/desktop/views/scroll.js#L42
With this view, it will always monitor the height/width, and automatically, add scroll bars if the contentView gets too big. Scroll Views are usually used to hold listView's which can get very long.
What you want todo is to is something like:
If the contentView is not a ListView (or another view that controls it's own layout), it is important to provide a layout, otherwise the ScrollView will not be effective.
PS. As a side note, this is not how to use a SC.SourceListGroupView. These are only for use to set as an 'exampleView' on a SC.SourceListView.
ScrollView 有一个标准子 contentView,然后可以有更多视图,请参阅 https://gist.github.com/781217 寻求解决方案
the ScrollView has one standard child the contentView which then can have more views, see https://gist.github.com/781217 for a solution