...
|
...
|
@@ -143,9 +143,7 @@ Level4:BLOCK-Heplers |
|
|
|
|
|
3. {{#unless condition}} inverse of the `if` helper
|
|
|
|
|
|
4. {{{{raw-helper}}}}
|
|
|
|
|
|
5. {{with ctx}}
|
|
|
4. {{with ctx}}
|
|
|
与Js的with一样,改变当前context,可以避免含有深层次嵌套属性时重复书写父级的名字
|
|
|
|
|
|
//tpl
|
...
|
...
|
@@ -167,7 +165,7 @@ Level4:BLOCK-Heplers |
|
|
}
|
|
|
}
|
|
|
|
|
|
6. {{lookup context key}} 获取动态参数进行渲染,相当于获取context.key的值,看例子会容易理解点:
|
|
|
5. {{lookup context key}} 获取动态参数进行渲染,相当于获取context.key的值,看例子会容易理解点:
|
|
|
|
|
|
//tpl
|
|
|
{{#each names}}
|
...
|
...
|
@@ -193,7 +191,7 @@ Level4:BLOCK-Heplers |
|
|
Name2 :Foo2
|
|
|
Name3 :Foo3
|
|
|
|
|
|
7. {{log info}} 打印调试
|
|
|
6. {{log info}} 打印调试
|
|
|
|
|
|
### Partials
|
|
|
Handlebars.registerPartials('parName', 'parContent'); 注册一个Partials;
|
...
|
...
|
|