淘汰教程神秘变化视图模型



如果您导航到此处的WebMail教程,您将能够看到有关如何创建SPA(单页应用程序)的教程。

如果您跳到步骤4,向下滚动信息框(左上角框),您可以单击底部的Help it's not working按钮,它将为您放置所有代码。

我的问题是,当邮件项目被点击时,它如何改变视图?我错过了一些东西,很明显,但不能把我的手指放在上面。

我需要知道,因为我想将其应用于 SPA,在那里我可以单击左侧菜单中的链接,并将主要内容更改为其他内容!

谢谢:)

我需要它告诉 html 不显示和 显示正确的

导航文件夹时,它将首先清除邮件数据self.chosenMailData(null);

// Client-side routes    
Sammy(function () {
    this.get('#:folder', function () {
        self.chosenFolderId(this.params.folder);
        self.chosenMailData(null);
        $.get("/mail", { folder: this.params.folder }, self.chosenFolderData);
    });
    this.get('#:folder/:mailId', function () {
        self.chosenFolderId(this.params.folder);
        self.chosenFolderData(null);
        $.get("/mail", { mailId: this.params.mailId }, self.chosenMailData);
    });
    this.get('', function () { this.app.runRoute('get', '#Inbox') });
}).run();

这是我做的一个小演示应用程序,如何使用SammyJS创建SPA引擎https://github.com/AndersMalmgren/Knockout.Bootstrap.Demo

最新更新