javascript - tryhandlebarsjs 注册 Helper 函数
问题描述
我有以下功能:
export const cellHelper = {
name: "cell",
handler: (context) => {
//...
return template
}
}
如果我按原样通过它,我会得到Error(s): SyntaxError: Unexpected token export
. 将它传递给tryhandlebarsjs.com的正确语法是什么?
解决方案
像这样传递它:
Handlebars.registerHelper('cell', function(context) {
//...
return template
});
推荐阅读
- java - 为什么 Eclipse 删除“自动构建”标志?
- image - 将原始DICOM图像转换为NIfTI图像后,蒙版无法匹配原始图像
- css - ReactJS 路由器 - 覆盖默认字体、大小写和颜色
- python - TypeError: 必须是实数,而不是 str。但是 int/float 中的数据
- typescript - 如何在 V13 中为 discord.js 上的成员分配角色?
- python - 无法导入请求模块(Python)
- python - Python, Tkinter - 关于代码的一些一般问题
- python - setup.py 未正确包含 package_data
- jquery - 使用spring-boot的ajax中的500服务器错误
- flutter - Flutter 用 SlideTransition 替换小部件