前端学习(1352)模板语法
生活随笔
收集整理的這篇文章主要介紹了
前端学习(1352)模板语法
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
demo27.js
const template = require('art-template'); //絕對(duì)路徑 模板中顯示的數(shù)據(jù) const path = require('path'); const views = path.join(__dirname, '01.art'); const html = template(views, {name: '張三',age: 20,content: '<h1>我是歌謠</h1>' }); console.log(html);01.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><p>{{name}}</p><p>{{age}}</p><p>{{content}}</p><p><%=name%></p><p><%=1+2%></p><p><%=content%></p> </body> </html>運(yùn)行結(jié)果
總結(jié)
以上是生活随笔為你收集整理的前端学习(1352)模板语法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Oracle数据库的下载与安装教程详解
- 下一篇: 前端学习(506):垂直居中的第二种方式