SC.LabelView.design 不可见

发布于 2024-10-11 21:41:55 字数 536 浏览 3 评论 0原文

  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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空城缀染半城烟沙 2024-10-18 21:41:55

ScrollView 是一个特殊的视图,因为它不使用 childViews 数组,而是期望有一个视图“contentView”,如下所示:

https://github.com/sproutcore/sproutcore/blob/master/frameworks/desktop/views/scroll.js#L42< /a>

使用此视图,它将始终监视高度/宽度,并在 contentView 太大时自动添加滚动条。滚动视图通常用于保存可能会很长的列表视图。

SC.ScrollView.design({
  contentView: SC.ListView.design({
    contentBinding: 'App.myContentArrayController'
  })
})

您想要做的是:

SC.ScrollView.design({
  contentView: SC.View.design({
    layout: {...},
    childViews: 'labLabel labMembersLabel'.w(),

    labLabel: SC.SourceListGroupView.design({ ... }),

    labMembersLabel: SC.LabelView.design({ ... })
  })
})

如果 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.

SC.ScrollView.design({
  contentView: SC.ListView.design({
    contentBinding: 'App.myContentArrayController'
  })
})

What you want todo is to is something like:

SC.ScrollView.design({
  contentView: SC.View.design({
    layout: {...},
    childViews: 'labLabel labMembersLabel'.w(),

    labLabel: SC.SourceListGroupView.design({ ... }),

    labMembersLabel: SC.LabelView.design({ ... })
  })
})

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.

半﹌身腐败 2024-10-18 21:41:55

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文