2011-12-27 2 views
0

나는 enyo를 배우고 팬을 사용하는 간단한 프로그램을 만들었습니다. 지금은 각 팬이 버튼입니다. 하나의 팬 대신에 각 팬에 많은 컨트롤을 넣을 수있는 방법이 있습니까? 예를 들어 내 코드에서 첫 번째 팬에는 butA라는 버튼이 있으며 3 개의 버튼이있을 수 있습니까? 내 코드enyo, 하나 이상의 컨트롤이있는 팬을 가지고있는 방법

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 
    }, 
}); 
+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"}, 
    ]}, 
]}, 
.... 
관련 문제