且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

小胡子不评估函数内部的{{}}

更新时间:2023-12-01 08:08:04

小胡子不会为您呈现内容.您的函数接受一个参数lastLoginAt,但Mustache将为您传递另一个参数:render.用lastLoginAt调用render将扩展变量:

Mustache won't render the contents for you. Your function takes one argument, lastLoginAt, but Mustache will pass you another: render. Calling render with lastLoginAt will expand the variable:

formatLastLoginAt: function () {
   return function (lastLoginAt, render) {
     lastLoginAt = render(lastLoginAt);  // expand variable
     return moment (lastLoginAt).format ('Do MMMM YYYY');
  }
}