0

我只是在学习enyo,并制作了一个简单的程序来使用平底锅。现在每个平底锅都是一个按钮。有没有办法在每个平底锅中拥有一堆控件,而不是一个?例如,在我的代码中,第一个平底锅有一个名为 butA 的按钮,它可以有 3 个按钮吗?我的代码

enyo.kind({
    name: "MyApps.MainApp",
    kind: enyo.VFlexBox,
    components: [
       {kind: "PageHeader", content: "Template"},
       {kind: "Pane", transitionKind: "enyo.transitions.LeftRightFlyin", components: [
           {kind: "Button", name:"butA", caption: "Pane A", onclick: "btnClickA"},
           {kind: "Button", name:"butB",caption: "Pane B", onclick: "btnClickB"}
       ]}
   ],
   /// code to switch pans
   btnClickA: function() {
       this.$.pane.selectView(this.$.butB);
   },

   btnClickB: function() {
       this.$.pane.selectView(this.$.butA);//k
   },
});
4

1 回答 1

1

你当然可以。该窗格为其组件数组中的每个对象创建一个视图,但这些组件可以包含子组件。例如,假设您想在一个窗格中创建视图,每个视图都有两个按钮,您可以使用如下内容:

...
{kind:enyo.Pane, components:[
    {kind:enyo.VFlexBox, name:"View1", components:[
        {kind:enyo.PageHeader, content:"Pane One"},
        {kind:enyo.Button, caption:"Button One"},
        {kind:enyo.Button, caption:"Button Two"},
    ]},
    {kind:enyo.VFlexBox, name:"View2", components:[
        {kind:enyo.PageHeader, content:"View Two"},
        {kind:enyo.Button, caption:"Button One"},
        {kind:enyo.Button, caption:"Button Two"},
    ]},
]},
....
于 2012-02-09T00:11:34.390 回答