【发布时间】:2017-11-16 22:09:36
【问题描述】:
当打开 Aurelia 对话框时,您通常会向它传递一个 viewModel。
这就是我目前的做法,但如果路径没有在这里硬编码会更好。
let lookupResponse = await this.dialogService.open(
{
model:
{
configuration: this.LookupConfiguration
caption: 'Select an item'
},
viewModel: 'App/Components/Lookup/LookupDialog'
});
我宁愿能够像路由一样引用 viewModel 路径
let lookupResponse = await this.dialogService.open(
{
model:
{
configuration: this.LookupConfiguration
caption: 'Select an item'
},
viewModel: App.routes.components.lookupdialog
});
如果你只是为组件添加一个 Routes.js 并尝试使用它,你会得到这个错误:
未捕获(承诺中)错误:无法确定默认视图策略 对象。
那么需要添加什么才能使其正常工作?某种自定义视图策略?
【问题讨论】:
标签: javascript aurelia