0

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

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

我的问题是,当一个邮件项目被点击时,它如何改变视图?我遗漏了一些东西,很明显,但不能指望它。

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

谢谢 :)

4

1 回答 1

1

我需要详细说明它告诉 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

于 2013-11-11T16:45:47.757 回答