Ember侧栏 - 从“admin”返回侧栏到“正常” [英] Ember sidebar - returning from "admin" sidebar to "normal"

查看:148
本文介绍了Ember侧栏 - 从“admin”返回侧栏到“正常”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用路由定义了我的侧边栏,如下所示( routes / application.js ):

My application route defines my sidebar as follows (routes/application.js):

renderTemplate: function() {

    this.render();

    // sidebar
    this.render("partials/sidebar", {
        outlet: "sidebar",
        into: "application" // important when using at root level
    });
}

当用户进入应用程序的管理区域时,有一个特殊的管理员侧边栏应用如下( routes / settings.js ):

When the user enters the admin area of the app, there is a special admin sidebar which is applied as follows (routes/settings.js):

renderTemplate: function() {

    this.render();

    // sidebar
    this.render("partials/sidebaradmin", {
        outlet: "sidebar",
        into: "application" // important when using at root level
    });
}

这样可以预期。但是,当离开设置区域时,侧边栏变为空白。

This works as you would expect. However, when leaving the settings area, the sidebar becomes blank.

正确的方法是确保用户转换到哪里,标准侧边栏重绘?

What is the correct way to ensure that regardless of where the user transitions to, that the standard sidebar redraws?

推荐答案

我写了一个插件,我在我的一些应用程序中使用,这有助于:

I've written an addon that I'm using in some of my apps which helps with this:

https://github.com/minutebase/ember- render-stack

这篇关于Ember侧栏 - 从“admin”返回侧栏到“正常”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆