草庐IT

javascript - close window and open a new window 钛合金

coder 2023-12-26 原文

我需要关闭 windows2 才能打开 windows3。我有下一个代码:我是钛初学者,请帮助我。

    //Windows1.XML
    <Alloy>
        <Window exitOnClose="false">
            <Button   onClick="openWindows2" visible="false">
            </Button>
        </Window>
    </Alloy>
    CONTROLLER
    //Window1.js
    function openWindows2(e)
    {
      var Window2=Alloy.createController('Window2').getView();
      newWindows.open(); 
    }
    $.Windows1.open()

这段代码是我在 windows1 上用第一个 Controller 打开的第二个 View //Window2.XML

    <Alloy>
        <Window exitOnClose="false">
            <Button   onClick="openWindows3" visible="false">
            </Button>
        </Window>
    </Alloy>

Controller 函数打开windows 3//Window2.js

    function openWindows3(e)
    {
      var Window3=Alloy.createController('Window3').getView();
      newWindows.open(); 
    }
    $.Windows2.open()

我的windows 3//Window3.XML

    <Alloy>
        <Window exitOnClose="false">
            <Button  onClick="anotherFn" visible="false">
            </Button>
        </Window>
    </Alloy>
    //Window3.js
    $.Windows3.open()

最佳答案

你用 XML 定义你的窗口,比如 mycoolwindow.xml。

然后从你的代码的其他部分:

 var win=Alloy.createController('mycoolwindow').getView();
 win.open();

请参阅此处示例:https://github.com/ricardoalcocer/AlloyOpenWindow

或转到此链接:http://www.youtube.com/watch?v=CB26lUj0UBQ

关于javascript - close window and open a new window 钛合金,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18669609/

有关javascript - close window and open a new window 钛合金的更多相关文章

随机推荐