おそらく、コールバックにを拡張Ember.Route
して追加する必要があります。次に、リーフルートにEmberを使用する代わりに、ルートを呼び出します。、ルート/状態を入力すると、自動的に上にスクロールします。これに似たもの:window.scrollTo
enter
Route
extend()
// define your custom route and extend "enter"
var MyRoute = Em.Route.extend({
enter: function(router) {
// for now on, all the routes that extend this,
// will fire the code in this block every time
// the application enters this state
// do whatever you need to do here: scroll and whatnot
}
});
App.Router = Em.Router.extend({
enableLogging: true,
location: 'hash',
index: Em.Route.extend({
route: '/',
connectOutlets: function(router) {
...
},
// on your leaf routes, use your own custom route that
// does your scroll thing or whatever you need to do
home: MyRoute.extend({
route: '/',
connectOutlets: function (router, context) {
...
}
}),
// other routes...
})
});
それは意味がありますか?