手动编译由 aurelia 中的其他自定义元素组成的 dom 元素

Manually compile dom elements that are composed of other custom elements in aurelia

本文关键字:元素 dom 自定义 其他 aurelia 编译      更新时间:2023-09-26

我正在使用Jeremy Danyow在此链接中指定的方法:

如何使用 ViewCompiler 手动编译部分 DOM?

这是我的代码:

this.viewFactory.insert(this.viewportEl, '<template><' + name + '></' + name + '></template>', this);

从某种意义上说,它正在替换 DOM 元素的内容,因此工作正常。但是,动态自定义元素未编译。我什至尝试在动态模板中添加一个 require 语句,它被很好地包含,但自定义元素仍未编译。

提前谢谢。

使用 globalResources 确保加载自定义元素。

https://gist.run/?id=762c00133d5d5be624f9