defining new variable within jquery template

前端 未结 3 1385
耶瑟儿~
耶瑟儿~ 2021-02-05 10:46

Is it possible to define a new variable within a jquery template? I read the official jquery template docs but could not find anything on this. I tried something like {{ v

3条回答
  •  执念已碎
    2021-02-05 11:40

    You can extend jquery template with eval tag

    $.extend($.tmpl.tag, { "eval": { open: "$1;"} });
    

    and use

    {{eval var xxx = 123}}
    {{eval xxx += 23}}
    

提交回复
热议问题