[英]Passing reusable blaze dropdown to sweet alert 2 html
I have a simple meteor template that creates a dropdown:我有一个创建下拉菜单的简单流星模板:
<template name="Select">
<div class="input-fields">
<select>
{{#each options}}
<option value="{{_id}}" selected={{optionSelected}}>{{name}}</option>
{{/each}}
</select>
</div>
</template>
I normally use it by adding it as a blaze spacebar:我通常通过将它添加为 blaze 空格键来使用它:
{{> Select
options=options
}}
Now I'm trying to pass this dropdown as the HTML argument inside a Sweet Alert 2 dialog, but blaze doesn't render the component, since swal is probably triggered after the blaze rendering is already finished.现在我试图将此下拉列表作为 Sweet Alert 2 对话框中的 HTML 参数传递,但 blaze 不会渲染组件,因为 swal 可能在 blaze 渲染完成后触发。 Is there another way to reuse the template inside the swal call?
还有另一种方法可以在 swal 调用中重用模板吗?
swal.fire({
title: "MyDropdown",
HTML: "{{> Select
options="+options+"}}",
})
I know you can natively add a dropdown in Sweet Alert 2, but I'm specifically interested in how to add my own templates to it.我知道您可以在 Sweet Alert 2 中直接添加下拉菜单,但我对如何向其中添加自己的模板特别感兴趣。
Did you try你试过了吗
Blaze.toHTML('Select')
or要么
Blaze.toHTMLWithData('Select',{options})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.