我沒有結果地尋找使用Meteor和Iframe的例子。 (請注意,由於最終會到達那裏的內容,我必須使用iframe而不是DIV)。我試過兩種方法:與流星一起使用IFrame
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
{{greeting}}
<input type="button" value="Click to see what you typed" />
<br>
<iframe id="compose" src={{> iframe-content}} height=600></iframe>
</template>
<template name="iframe-content">
<body>
<div contenteditable="true">
Edit me
</div>
</body>
</template>
這個遞歸加載,連續創建子Iframe。
我也試過
<iframe id="compose" src="content.html" height=600></iframe>
但流星munges的多個HTML文件一起這也導致了iframe失敗。
到目前爲止,唯一可行的工作是SRCDOC而不是SRC,但是多種瀏覽器(如FF)不能很好地支持該功能。
那麼,在Meteor中使用iframe有什麼用,最好是在模板中,而不是嚴格通過代碼?
我應該明確地說過,content.html是磁盤上的一個文件,它包含必要的HTML,減去Meteor抱怨的標籤,如。我試圖避免爲這樣簡單的事情添加路由包。添加一個路由包也意味着我必須更多地使用代碼而不是聲明性的。 –