gpt4 book ai didi

javascript - 在 mustache javascript 中使用参数调用函数

转载 作者:IT王子 更新时间:2023-10-29 02:59:08 25 4
gpt4 key购买 nike

是否可以使用 Mustache.js 参数调用函数

{{somefunction(somevalue)}}
谢谢

最佳答案

https://mustache.github.io/mustache.5.html 查看有关 Lambda 的部分

mustache 模板 block :

{{#someFunction}}someValue{{/someFunction}}

功能 block :

someFunction : function () {
return function(val, render) {
return "I passed in this value: " + render(val);
};
}

输出:

I passed in this value: someValue

关于javascript - 在 mustache javascript 中使用参数调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6045165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com