以前,我的路線被定義爲:爲什麼我需要在Ember.js中定義索引路由?
this.route('username', {
path: '/:username'
}, function() {
this.route("room", {
path: "/:room",
});
我把它改爲:
this.route('username', {
path: '/:username'
}, function() {
this.route('index')
});
this.route("room", {
path: "/:room"
});
這工作得很好。但我的username/index
路線將不會加載,除非我明確定義索引router.js
。
下面就不工作:
this.route('username', {
path: '/:username'
});
this.route("room", {
path: "/:room",
});
這是正常的行爲呢?
也許你能證明這樣一個例子:https://ember-twiddle.com/c310013f69c086cecaa38b1d355c49f3?openFiles=templates.username.hbs%2C&route=%2Fusername我通常不會使用索引路線,而是更具體地命名它們。 – sheriffderek