1

一个例子,我有一个我创建的刷新按钮,显示在顶部,我可以有代码稍后删除这个控件吗??????

带有刷新按钮的代码我想稍后在程序运行时删除

enyo.kind({
    name: "MyApps.MainApp",
    kind: enyo.VFlexBox,
    components: [

        {name: "gotCommentsSer", kind: "WebService",
            onSuccess: "gotComments", url: "testservice.json",
            onFailure: "gotCommentsFailure"},   
        {name: "getPendingSer", kind: "WebService",
            onSuccess: "gotPending", url: "testservice.json",
            onFailure: "gotPendingFailure"},

        {kind: "PageHeader", content: "Template"},
        {kind: "Button", caption: "Refresh", onclick: "btnRefresh"},
        {name:"curValue", content:("Sample Text")}, 
 //     {name: "feedUrl", kind: "Input", flex: 1},  
        {kind: "RichText", name: "PendingMsg", value: "To <b>boldly</b> go..", onchange: "richTextChange"},    
        {kind: "Scroller", flex: 1, components: [
            {kind: "VirtualRepeater", name: "list", onSetupRow: "setupRow", components: [
                 {kind: "Item", layoutKind: "HFlexLayout", components: [
                      {kind: "HtmlContent", name: "caption2" , onLinkClick: "btnClick"}
                  ]}
            ]}
        ]},        
        {kind: "Toolbar", name: "tabs"}  
    ],
4

1 回答 1

1

您可能更容易 .hide() 您的控件而不是完全销毁它。如果你真的想摆脱它,你应该参考动态创建组件的部分。要删除组件,请尝试:

this.$.Button.destroy();
于 2012-01-05T22:12:59.267 回答