如何将路径放在子文件夹中而不更改Ember中的URL

时间:2017-10-25 18:03:29

标签: ember.js

我的链接目前在我的主要路径中。我想将它们分组到子文件夹而不更改URL。例如,我有/income-statement,我想将文件放在报告目录中。使用嵌套路由,网址变为/reports/income-statement。我尝试将报告级别的路径设置为{path: ''},但它与我的主路径

冲突
this.route('reports', function() {
  this.route('accounts-receivable')
  this.route('income-statement')
})

2 个答案:

答案 0 :(得分:1)

我想通过将../添加到路径的开头

来实现这一目标
this.route('reports', function() {
  this.route('accounts-receivable', {path: '../accounts-receivable'})
  this.route('income-statement', {path: '../income-statement'})
})

答案 1 :(得分:1)

指定组路由的路径为/

this.route('reports', { path: '/' }, function() {
  this.route('accounts-receivable')
  this.route('income-statement')
});