可重用Blaze组件的自定义onClick行为

时间:2016-04-08 13:48:10

标签: meteor meteor-blaze

我的Meteor应用中有以下可重用组件

<template name="action_button">
    <div class="action-button-container pull-right">
        <div class="btn btn-danger action-button js-action-button" title="{{this.buttonTitle}}">
            <span class="glyphicon glyphicon-{{this.buttonIcon}}"></span>
        </div>
        <div class="action-button-title">{{this.buttonTitle}}</div>
    </div>
</template>
Template.action_button.events({
    'click .js-action-button': function(e, tmpl) {
        e.preventDefault();

        // ?
    }
});

实例化如下:

<template name="my_main_template">
    ...

    {{# action_button buttonTitle="save" buttonIcon="ok" }} {{/ action_button}}

    ...
</template>

将自定义onClick行为添加到此按钮的实例的最佳方法是什么?

0 个答案:

没有答案