Sencha Touch - Layout Card
描述
卡片 − 此布局以选项卡方式排列不同的组件。选项卡将显示在容器顶部。每次只有一个选项卡可见,每个选项卡被视为不同的组件。
语法
以下是使用卡片布局的简单语法。
layout: 'card'
示例
以下是一个简单的示例,展示了卡片布局的用法。
<!DOCTYPE html> <html> <head> <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" /> <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script> <script type = "text/javascript"> Ext.application({ name: 'Sencha', launch: function() { var panel = Ext.create('Ext.Panel', { layout: 'card', items: [ { html: "First Item index value is 0" }, { html: "Second Item index value is 1 which we are setting as active index" }, { html: "Third Item index value is 2" }, { html: "Fourth Item index value is 3" } ] }); panel.setActiveItem(1); Ext.Viewport.add(panel); } }); </script> </head> <body> </body> </html>
这将产生以下结果 −