问题
I am trying to add a router to a custom element. The element should have two subviews where user can switch between them. However, I have run into a problem:
export class customElement {
configureRouter(config,router) { ... } //this is not getting called
}
This question is related and an answer to the question states that "It will not work if it is a custom element."
Is there a workaround or is this just not possible?
回答1:
This is not possible. Custom elements are not the same as routed view-models. And Aurelia offers no way you can easily achieve this with a custom element.
来源:https://stackoverflow.com/questions/39569853/child-router-in-custom-element