Handlebars 팁
1347 단어 handlebars
1. 자가용 방법
1. 각각을 훑어보다
var data = [{id:'first',name:'vuturn'},{id:'second',name:'John'}];
{{#each this}}
<span>{{this.id}}</span>
<span>{{this.name}}</span>
{{/each}}
2. 동일 여부 equal
{{#equal key 1}}
<span>Test</span>
{{/equal}}
3.if
{{#if key}}
<span>Test</span>
{{/if}}
4. 상위 변수 호출
../key
2. helper 등록
1. 반복 그룹 표시 색인 방법 등록
등록:Handlebars.registerHelper('addKey',function(index){
return index + 1;
});
사용:{{#each this}}
{{addKey @index}}
{{/each}}
2. if(v1==v2){}else{} 방법 등록
등록: Handlebars.registerHelper('ifCond',function(v1 , v2 ,options){
if(v1 == v2){
return options.fn(this);
}
return options.inverse(this);
});
사용: {{#ifCond key value}}
<span>test</span>
{{else}}
<span>test</span>
{{/ifCond}}
참조:http://handlebarsjs.com/
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
NestJS로 이메일 보내기
이 게시물은 백엔드에서 을 사용하여 이메일을 보내는 데 필요한 모든 정보를 제공합니다.
📧 을 사용하여 이메일 보내기
🧩 으로 이메일 템플릿 만들기(대체: pug 또는 ejs)
⚙️ .env 파일을 통해 smtp 구...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.
var data = [{id:'first',name:'vuturn'},{id:'second',name:'John'}];
{{#each this}}
<span>{{this.id}}</span>
<span>{{this.name}}</span>
{{/each}}
{{#equal key 1}}
<span>Test</span>
{{/equal}}
{{#if key}}
<span>Test</span>
{{/if}}
1. 반복 그룹 표시 색인 방법 등록
등록:
Handlebars.registerHelper('addKey',function(index){
return index + 1;
});
사용:{{#each this}}
{{addKey @index}}
{{/each}}
2. if(v1==v2){}else{} 방법 등록
등록:
Handlebars.registerHelper('ifCond',function(v1 , v2 ,options){
if(v1 == v2){
return options.fn(this);
}
return options.inverse(this);
});
사용: {{#ifCond key value}}
<span>test</span>
{{else}}
<span>test</span>
{{/ifCond}}
참조:http://handlebarsjs.com/
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
NestJS로 이메일 보내기이 게시물은 백엔드에서 을 사용하여 이메일을 보내는 데 필요한 모든 정보를 제공합니다. 📧 을 사용하여 이메일 보내기 🧩 으로 이메일 템플릿 만들기(대체: pug 또는 ejs) ⚙️ .env 파일을 통해 smtp 구...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.