我正在查看生成的 JavaScript:
相关代码为
我的问题是,$this指的是什么?只是关键字“this”我理解,但是$this?周围似乎没有任何 jQuery。
感谢您的启发。
最佳答案
这与 Google "jstemplate" 有关机制。
从该页面:
$this: $this refers to the JsEvalContext data object used in processing the current node. So in the above example we could substitute $this.end for end without changing the meaning of the jscontent expression. This may not seem like a very useful thing to do in this case, but there are other cases in which $this is necessary. If the JsEvalContext contains a value such as a string or a number rather than an object with named properties, there is no way to retrieve the value using object-property notation, and so we need $this to access the value.
关于javascript - JavaScript 中的 $this 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20412717/