Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript库语法的机制和含义:${value}_Javascript_Templates - Fatal编程技术网

JavaScript库语法的机制和含义:${value}

JavaScript库语法的机制和含义:${value},javascript,templates,Javascript,Templates,我在O'Reilly的文章中遇到了以下JavaScript代码片段 JavaScript Web应用程序: // helper.js var helper = {}; helper.formatDate = function(){ /* ... */ }; // template.html <div> ${ helper.formatDate(this.date) } </div> //helper.js var-helper={}; helper.formatD

我在O'Reilly的文章中遇到了以下JavaScript代码片段 JavaScript Web应用程序:

// helper.js
var helper = {};
helper.formatDate = function(){ /* ... */ };

// template.html
<div>
  ${ helper.formatDate(this.date) }
</div>
//helper.js
var-helper={};
helper.formatDate=函数(){/*…*/};
//template.html
${helper.formatDate(this.date)}
但是,此处未提供对任何特定JavaScript库的引用。 ${…}语法的可能含义是什么?它是如何工作的? 这是否来自使用任何特定的库?我见过 jQuery的$()表示法,其中$是一个函数,但我还没有看到 $后跟一对花括号


谢谢。

它可能来自旧版本,不再处于开发阶段或其他模板引擎:


它只是
template.html
中的一个占位符。好吧,令人费解的是,一旦函数返回,我希望看到类似${2003-04-05}或类似的东西,看起来不像变量名。一个日期值怎么可能是一个合理的模板变量名呢?它可能确实是这样,但是否有一个继承者取代了使用相同语法等的已失效的jQuery Tmpl库?