backbonejs和requirejs的实例

复制代码
define(['login', 'ApplyFlapper'],  //为ApplyFlapper为ApplyFlapper.js文件
    function (loginView,  applyFlapperView) {   //applyFlapperView的view
        var Router = Backbone.Router.extend({
            routes: {
                '': 'showHome',
               
                'applyFlapper': 'showApplyFlapper',   //对应的是页面applyFlapper.html,showApplyFlapper()为打开页面的方法
            },
            data: {
                module_login: null,
              
                module_ApplyFlapper: null,
            },
            showHome: function () {
                if (!this.data.module_auctionList) {
                    this.data.module_auctionList = new auctionListView();
                }
                this.data.module_auctionList.render();
            },
               showApplyFlapper: function () {
                console.log("go to ApplyFlapper");
                if (!this.data.module_ApplyFlapper) {
                    this.data.module_ApplyFlapper = new applyFlapperView();
                }
                this.data.module_ApplyFlapper.render();
            },
            init: true
            }
           });
复制代码

 

posted on   huangfenggu  阅读(286)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示