添加 <link/><head> 的标签流星应用部分 [英] Adding <link /> tags to the <head> section in meteor application
本文介绍了添加 <link/><head> 的标签流星应用部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的模板:
<template name="sidebar">
<ul class="sidenav-list">
{{#each links}}
<li draggable="true" class="sidenav-list-item">
<a href="{{link}}" class="sidenav-list-item__link">
{{ name }}
</a>
</li>
{{/each}}
</ul>
</template>
现在我需要添加 <link rel="prefetch" href="{{link}}"/>
到 <head>
部分links
数组中的每个链接.
And now I need to add <link rel="prefetch" href="{{link}}" />
to <head>
section for every single link from links
array.
在模板中添加 标记无济于事.任何想法如何做到这一点?
Adding a <head>
tag inside the template doesn't help. Any ideas how to do it?
提前致谢!
推荐答案
目前尚不支持:
https://github.com/meteor/meteor/issues/266
但是,您可以使用普通 DOM 操作向 元素添加内容,最好使用
Meteor.startup
.请参阅上面链接中给出的反应式示例.
However, you can add things to the <head>
element using normal DOM manipulation, preferably using Meteor.startup
. See the reactive example given in the link above.
这篇关于添加 <link/><head> 的标签流星应用部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文