vue
Example1
const todos=[ { 'id':1, 'title':"吃饭" }, { 'id':2, 'title':"吃饭2" }, ] router .get("/",(req,rep,next)=>{ rep.json(todos) }) .post("/",(req,rep,next)=>{ var todo={ title:req.body.title, id:todos[todos.length-1].id+1 } todos.push(todo) rep.json(todos) })<body> <ul id="container"> </ul> <script id="tpl" type="text/template"> {{ each todos }} <li>{{$value}}</li> {{/each}} </script> </body> <script src="/node_modules/jquery/dist/jquery.min.js" type="text/javascript" charset="utf-8"></script> <script src="/node_modules/art-template/lib/template-web.js" type="text/javascript" charset="utf-8"></script> <script> $(document).ready(function(){ $.get('/',function(data){ console.log(data); var htmlStr=template('tpl',{ todos:data }) $("#container").html(htmlStr) }) }) </script>
单页方式进行加载
解决单页面路由问题
基于前端框架进行的单页操作
工具
Last updated