有什么推荐的方法来执行以下操作?
我有一个带有一些由浏览器布局的 html 内容的表面。在 html 中,希望有一个带有表面的额外 Scrollview。从哪里获取 Scrollview 的 x、y 和宽度、高度?我是否必须等待 html 被渲染然后将 inner-html 部分转换为表面?
有什么推荐的方法来执行以下操作?
我有一个带有一些由浏览器布局的 html 内容的表面。在 html 中,希望有一个带有表面的额外 Scrollview。从哪里获取 Scrollview 的 x、y 和宽度、高度?我是否必须等待 html 被渲染然后将 inner-html 部分转换为表面?
您不能将表面用作其他表面的容器。您需要在 View、RenderNode 或 ContainerSurface 对象中收集所有表面。
https://github.com/Famous/core/blob/master/View.js https://github.com/Famous/core/blob/master/RenderNode.js https://github.com/Famous/surfaces/ blob/master/ContainerSurface.js
请记住,Famo.us 布局内容的方式是呈现树的样式。用树类比,Surface 将是一片叶子,上面提到的 Objects 将更像树枝。
以下是您需要了解的有关 Famo.us 渲染树的所有信息:
https://github.com/Famous/guides/blob/master/dev/2014-04-09-render-tree.md
此外,还请查看提到的每个对象的示例。您可以找到最适合您的用例的那个..
https://github.com/Famous/examples/blob/master/src/examples/core/View/example.js https://github.com/Famous/examples/blob/master/src/examples/surfaces/ContainerSurface /example.js
希望这可以帮助!