我有一个空格键模板,用于创建一个调用模式的按钮:
{{#bootstrapModal
triggerLabel="Delete"
triggerIcon="fa-trash-o"
triggerClass="btn-danger"
id="deleteModal"
title="Delete Item"
closeLabel="No"
primaryLabel="Delete it!"
infoId="item123"
infoName="Document 123"
}}
Are you sure you want to delete?
{{/bootstrapModal}}
bootstrapModal 模板:
<template name="bootstrapModal">
<button class="btn {{triggerClass}}" data-toggle="modal" data-target="#{{id}}">
{{#if triggerIcon}}
<i class="fa {{triggerIcon}}"> {{triggerLabel}}</i>
{{/if}}
</button>
<div class="modal fade" id="{{id}}">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">{{title}} {{infoName}}</h4>
</div>
<div class="modal-body">
{{> UI.contentBlock}}
<b>{{infoName}}</b>
</div>
<div class="modal-footer">
{{#if closeLabel}}
<button type="button" class="btn btn-default" data-dismiss="modal">{{closeLabel}}</button>
{{/if}}
<button type="button" class="btn btn-primary">{{primaryLabel}}</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
它创建了一个按钮,为其分配了一个模态,然后我使用一个助手为模态分配功能。
我正在使用出色的反应式表包和 fn 功能https://github.com/ecohealthalliance/reactive-table#virtual-columns。我想使用一个对象作为参数来插入表格单元格,因为据我所知,您不能在函数中使用把手/空格键 {{ }} 语法。谁能指出我正确的方向?我在下面有一些代码...
{ key: 'hello', label: "Tools", fn: function(value, object) {
var context = {
triggerLabel: "Delete",
triggerIcon: "fa-trash-o",
triggerClass: "btn-danger",
id: "deleteModal",
title: "Delete Item",
closeLabel: "No",
primaryLabel: "Delete it!",
infoId: object._id,
infoName: object.name
}
// how to insert the context object into the bootstrapModal spacebars template in raw JS?
}
Meteor 比较新,有什么线索吗?