我只是在学习enyo,并且做了一个简单的程序来使用pans。现在,每个平移盘都是一个按钮。有没有办法在每个pan中有一堆控件,而不是一个控件?在我的代码中,第一个pan有一个名为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
},
});发布于 2012-02-09 08:11:34
你当然可以。窗格为其组件数组中的每个对象创建一个视图,但这些组件可以包含子组件。例如,假设您想要在一个窗格中创建视图,每个视图都有两个按钮,您可以使用如下所示:
...
{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"},
]},
]},
....https://stackoverflow.com/questions/8650390
复制相似问题