浏览器使用art-template(模版引擎)

浏览器使用art-template

安装

npm install art-template --save  

在需要的文件模块中引用 art-template

<script src="./node_modules/art-template/lib/template-web.js"></script>

查看文档 api

https://github.com/aui/art-template

完整代码 + 效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>浏览器使用art-template.html</title>

    <script src="./node_modules/art-template/lib/template-web.js"></script>
</head>
<body>
	<span class="_span"></span>
	<script type="text/template" id="tp1">
        hello {{ name }} {{age}}
    </script> 
    <script>
        var ret = template('tp1',{
            name:'ggggg',
            age:18
        })
        var _span = document.querySelector('._span')  
        _span.innerText = ret;
        console.log(ret)
    </script>
</body>
</html>

效果图
浏览器使用art-template(模版引擎)

上一篇:xposed插件加固保护方案以及对华为方舟编译器的思考


下一篇:tools: the art of debugging with GDB DDD