前端学习(1355) 子模板
生活随笔
收集整理的這篇文章主要介紹了
前端学习(1355) 子模板
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
const template = require('art-template');
//絕對路徑 模板中顯示的數據
const path = require('path');
const views = path.join(__dirname, '04.art');
const html = template(views, {msg: '我是首頁',name: 'geyao',age: 20
});
console.log(html);
04.art
{{include'./index.art'}} {{msg}}index.art
<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title> </head> <body>{{name}}{{age}} </body> </html>運行結果
總結
以上是生活随笔為你收集整理的前端学习(1355) 子模板的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 网管世界 网管生活 网管总结
- 下一篇: 前端学习(1035):bootstrap