前端学习(1353)模板语法条件判断
生活随笔
收集整理的這篇文章主要介紹了
前端学习(1353)模板语法条件判断
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
const template = require('art-template');
//絕對路徑 模板中顯示的數據
const path = require('path');
const views = path.join(__dirname, '02.art');
const html = template(views, {name: '張三',age: 20,/* content: '<h1>我是歌謠</h1>' */
});
console.log(html);
02.art
{{if age>18}} 年齡大于18 {{else if age<15}} 年齡小于15 {{else}} 不符合要求 {{/if}}<%if(age>18) {%>年齡大于18<% } %>運行結果
總結
以上是生活随笔為你收集整理的前端学习(1353)模板语法条件判断的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: har后缀文件怎么提取?
- 下一篇: Foobar2000是一款完全可定制的音