Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello,Chassis! #11

Open
xspider opened this issue May 24, 2013 · 0 comments
Open

Hello,Chassis! #11

xspider opened this issue May 24, 2013 · 0 comments
Labels

Comments

@xspider
Copy link
Collaborator

xspider commented May 24, 2013

创建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();
miller added a commit that referenced this issue May 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant