template.html 699 B

123456789101112131415161718192021222324252627
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title></title>
  5. <meta charset="utf-8">
  6. <script src="../dist/seed.js"></script>
  7. </head>
  8. <body>
  9. <div sd-template="todo">
  10. <p>{{hi}}!</p>
  11. </div>
  12. <script>
  13. var Test = Seed.ViewModel.extend({
  14. template: 'todo',
  15. init: function (msg) {
  16. this.hi = msg
  17. }
  18. })
  19. var hawaii = new Test({ args: ['Aloha'] }),
  20. china = new Test({ args: ['你好'] })
  21. document.body.appendChild(hawaii.$el)
  22. document.body.appendChild(china.$el)
  23. </script>
  24. </body>
  25. </html>