简体   繁体   English

tryhandlebarsjs注册助手功能

[英]tryhandlebarsjs Register Helper functions

I am playing around with tryhandlebarsjs.com 我在玩tryhandlebarsjs.com

I have following function: 我有以下功能:

export const cellHelper = {
    name: "cell",
    handler: (context) => {
        //...
        return template
    }
}

If I pass it as is I get Error(s): SyntaxError: Unexpected token export . 如果按原样传递,则会出现Error(s): SyntaxError: Unexpected token export What is the correct syntax to pass it into tryhandlebarsjs.com ? 将其传递到tryhandlebarsjs.com的正确语法是什么?

Pass it like this: 像这样传递它:

Handlebars.registerHelper('cell', function(context) {
   //...
   return template
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM