gpt4 book ai didi

html - 将 aurelia-app 属性移动到另一个 html 元素?

转载 作者:太空狗 更新时间:2023-10-29 14:54:58 24 4
gpt4 key购买 nike

aurelia 的所有示例似乎都放置了 aurelia-app关于 <body> 的指令元素。

可以aurelia-app放置在其他 html 元素上,而不是 <body> ?如果是这样,是否有理由避免这样做?

最佳答案

official documentation状态:

Simply place this on an HTML element and Aurelia's bootstrapper will load an app.js and app.html, databind them together and inject them into the DOM element on which you placed that attribute.

我测试了这个:

<body>
<div aurelia-app="app-window">
</div>
...
</body>

它确实在那个时候注入(inject)了你的 aurelia 应用程序:

enter image description here

我不知道这是否是个好主意,即这样做是否会出现无法预料的问题。

关于html - 将 aurelia-app 属性移动到另一个 html 元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37293771/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com