xiaolizi007
11/22/2016 - 7:05 AM

From http://wiki.jikexueyuan.com/project/kendo-ui-development-tutorial/the-layout-single-page-applications.html Layout 本身也是一个 View,因此在 showI

From http://wiki.jikexueyuan.com/project/kendo-ui-development-tutorial/the-layout-single-page-applications.html Layout 本身也是一个 View,因此在 showIn 方法中也可以传入一个 Layout 对象,从而实现 Layout 的嵌套支持。 Layout 定义多个 View 统一的布局,定义了 View 的 Placeholder,因此在应用中可以实现 View 的切换


<div id="app"></div>

<script>
    var foo = new kendo.View("<span>Foo</span>", { hide: function() { console.log("Foo is hidden now"); }});
    var bar = new kendo.View("<span>Bar</span>");

    var layout = new kendo.Layout("<header>Header</header><section id='content'></section><footer></footer>");

    layout.render($("#app"));

    layout.showIn("#content", foo);
    layout.showIn("#content", bar);
</script>