Chassis icon indicating copy to clipboard operation
Chassis copied to clipboard

Hello,Chassis!

Open xspider opened this issue 12 years ago • 0 comments

创建index.html:

<!doctype html>
<html>
<head>
  <meta charset='utf8'>
  <title>Hello,Chassis!</title>
</head>
<body>
    <div id="example"></div>

  <script type="text/template" id="demo">
    hello,<%= name %>!
  </script>
  <script src="lib/baidutemplate.js"></script>
  <script src="../../build/chassis.js"></script>
  <script src="lib/app.js"></script>
</body>
</html>

创建lib/app.js:

var Router = Chassis.Router.extend({
    routes : [ '' ]
});


Chassis.PageView.index = Chassis.PageView.extend({
    el: '#example',

    init : function(){
        var tpl = $('#demo').html(), data;
        this.model = new Chassis.Model( {name : 'Chassis'} );

        data = this.model.toJSON();

        this.$el.html( baidu.template( tpl,  data ) );
    }
});

var router = new Router;
Chassis.history.start();

xspider avatar May 24 '13 05:05 xspider