自定义元素中的子路由器 [英] Child router in custom element

查看:83
本文介绍了自定义元素中的子路由器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将路由器添加到自定义元素.元素应具有两个子视图,用户可以在其中进行切换.但是,我遇到了一个问题:

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?

推荐答案

这是不可能的.自定义元素与路由视图模型不同.而且Aurelia无法提供使用自定义元素轻松实现此目标的方法.

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.

这篇关于自定义元素中的子路由器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆