pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<legend id='3H0cr'><style id='3H0cr'><dir id='3H0cr'><q id='3H0cr'></q></dir></style></legend>

<small id='3H0cr'></small><noframes id='3H0cr'>

    <i id='3H0cr'><tr id='3H0cr'><dt id='3H0cr'><q id='3H0cr'><span id='3H0cr'><b id='3H0cr'><form id='3H0cr'><ins id='3H0cr'></ins><ul id='3H0cr'></ul><sub id='3H0cr'></sub></form><legend id='3H0cr'></legend><bdo id='3H0cr'><pre id='3H0cr'><center id='3H0cr'></center></pre></bdo></b><th id='3H0cr'></th></span></q></dt></tr></i><div class="5drj5nd" id='3H0cr'><tfoot id='3H0cr'></tfoot><dl id='3H0cr'><fieldset id='3H0cr'></fieldset></dl></div>

      <bdo id='3H0cr'></bdo><ul id='3H0cr'></ul>
    <tfoot id='3H0cr'></tfoot>

    1. router.js 函數(shù)未執(zhí)行

      router.js Function not executed(router.js 函數(shù)未執(zhí)行)

          • <i id='P0cP7'><tr id='P0cP7'><dt id='P0cP7'><q id='P0cP7'><span id='P0cP7'><b id='P0cP7'><form id='P0cP7'><ins id='P0cP7'></ins><ul id='P0cP7'></ul><sub id='P0cP7'></sub></form><legend id='P0cP7'></legend><bdo id='P0cP7'><pre id='P0cP7'><center id='P0cP7'></center></pre></bdo></b><th id='P0cP7'></th></span></q></dt></tr></i><div class="lxnlj5t" id='P0cP7'><tfoot id='P0cP7'></tfoot><dl id='P0cP7'><fieldset id='P0cP7'></fieldset></dl></div>
              <tbody id='P0cP7'></tbody>
              <legend id='P0cP7'><style id='P0cP7'><dir id='P0cP7'><q id='P0cP7'></q></dir></style></legend><tfoot id='P0cP7'></tfoot>

              <small id='P0cP7'></small><noframes id='P0cP7'>

                <bdo id='P0cP7'></bdo><ul id='P0cP7'></ul>

              • 本文介紹了router.js 函數(shù)未執(zhí)行的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                <塊引用>

                //文件名:router.jsconsole.log('測試路線');定義(['jquery','下劃線','骨干','視圖/工作/列表'], 函數(shù)($, _, Backbone, JobListView){var AppRouter = Backbone.Router.extend({路線:{//定義一些 URL 路由'/dalo??/jobs': 'showJobs',//默認(rèn)'*actions': 'defaultAction'}});var 初始化 = 函數(shù)(){var app_router = 新的 AppRouter;app_router.on('route:showJobs', function(){//在我們通過依賴數(shù)組加載的模塊上調(diào)用渲染//'視圖/工作/列表'console.log('顯示作業(yè)路徑');var jobListView = new JobListView();jobListView.render();});app_router.on('defaultAction', function(actions){//我們沒有匹配的路由,讓我們記錄一下 URL 是什么console.log('No route:', actions);});Backbone.history.start();};返回 {初始化:初始化};});

                我的 main.js 的一部分,我沒有使用 NEW,因?yàn)樗o出了一個(gè)問題,說它不是一個(gè)函數(shù),不確定它是否與上面的錯(cuò)誤有關(guān)

                require(['app'], function(AppView){AppView.initialize();});

                我在 Router.initialize() 之后做了一個(gè) console.Log;在 app.js ,它可以顯示.我還在這個(gè)應(yīng)用程序 router.js 上面一直做了一個(gè)控制臺(tái)日志,它也顯示,除此之外,它沒有顯示函數(shù)內(nèi)部的任何內(nèi)容.

                控制臺(tái)只顯示 2 個(gè)控制臺(tái)日志(在 Route.Initialize 之后 & 在 router.js 定義之前

                有什么建議嗎?我正在使用 http://backbonetutorials.com/organizing-backbone-using-modules/

                我的 App.js

                define(['jquery','下劃線','骨干','router',//請(qǐng)求 router.js], 函數(shù)($, _, Backbone, Router){var 初始化 = 函數(shù)(){//傳入我們的路由器模塊并調(diào)用它的初始化函數(shù)路由器初始化();console.log('路由器初始化');}返回 {初始化:初始化};});

                解決方案

                可能您使用的是 非 AMD 版本的 Backbone.js 和 Underscore.js.

                通過這種方式,您必須將所謂的墊片"添加到您的主/配置文件中.

                <塊引用>

                shim:為較舊的傳統(tǒng)瀏覽器全局變量"腳本配置依賴項(xiàng)、導(dǎo)出和自定義初始化,這些腳本不使用 define() 來聲明依賴項(xiàng)并設(shè)置模塊值.http://requirejs.org/docs/api.html#config-shim

                正如您所看到的,設(shè)置依賴項(xiàng)并導(dǎo)出您的庫,以便您在腳本中使用它.

                因此,在您的主/配置文件中,在路徑之后嘗試添加此墊片部分:

                路徑:{...},墊片:{'主干':{deps: ['jquery','underscore'],出口:骨干"}}

                現(xiàn)在我想你可以繼續(xù)......

                // Filename: router.js
                console.log('TEST ROUTE');
                define([
                    'jquery',
                    'underscore',
                    'backbone',
                    'views/jobs/list'
                ], function($, _, Backbone, JobListView){
                    var AppRouter = Backbone.Router.extend({
                        routes: {
                            // Define some URL routes
                            '/dalo/jobs': 'showJobs',
                
                            // Default
                            '*actions': 'defaultAction'
                        }
                    });
                
                    var initialize = function(){
                        var app_router = new AppRouter;
                        app_router.on('route:showJobs', function(){
                            // Call render on the module we loaded in via the dependency array
                            // 'views/jobs/list'
                            console.log('Show Job Route');
                            var jobListView = new JobListView();
                            jobListView.render();
                
                        });
                
                        app_router.on('defaultAction', function(actions){
                            // We have no matching route, lets just log what the URL was
                            console.log('No route:', actions);
                        });
                        Backbone.history.start();
                    };
                    return {
                        initialize: initialize
                    };
                });
                

                Part of my main.js , i didnt use NEW because it gave issues saying it's not a function not sure if it's related to the error above

                require(['app'], function(AppView){
                    AppView.initialize();
                });
                

                I did a console.Log after Router.initialize(); at app.js , it can show. I also did a console log all the way above in this app router.js it's also showing, other than that , it doesnt show anything inside the function.

                The console is only showing that 2 console Log (After Route.Initialize & Before router.js define

                Any advice? I'm using http://backbonetutorials.com/organizing-backbone-using-modules/

                My App.js

                define([
                    'jquery',
                    'underscore',
                    'backbone',
                    'router', // Request router.js
                ], function($, _, Backbone, Router){
                    var initialize = function(){
                        // Pass in our Router module and call it's initialize function
                        Router.initialize();
                        console.log('Router Initialized');
                    }
                
                    return {
                        initialize: initialize
                    };
                });
                

                解決方案

                Probably you're using a non-AMD version of Backbone.js and Underscore.js.

                This way you've to add what it's called a "shim" to your main/config file.

                shim: Configure the dependencies, exports, and custom initialization for older, traditional "browser globals" scripts that do not use define() to declare the dependencies and set a module value. http://requirejs.org/docs/api.html#config-shim

                As you can see this set dependencies and export your lib in order to let you using it in your scripts.

                So, in your main/config file, after the paths try adding this shim part:

                paths: {
                    ...
                },
                shim: {
                    'backbone': {
                        deps: ['jquery','underscore'],
                        exports: 'Backbone'
                    }
                }   
                

                Now I suppose you could proceed ...

                這篇關(guān)于router.js 函數(shù)未執(zhí)行的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動(dòng)游標(biāo)不起作用)
                PHP PDO ODBC connection(PHP PDO ODBC 連接)
                Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個(gè)值;等于變量的值)
                MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動(dòng)程序)
              • <small id='npCAJ'></small><noframes id='npCAJ'>

                  <i id='npCAJ'><tr id='npCAJ'><dt id='npCAJ'><q id='npCAJ'><span id='npCAJ'><b id='npCAJ'><form id='npCAJ'><ins id='npCAJ'></ins><ul id='npCAJ'></ul><sub id='npCAJ'></sub></form><legend id='npCAJ'></legend><bdo id='npCAJ'><pre id='npCAJ'><center id='npCAJ'></center></pre></bdo></b><th id='npCAJ'></th></span></q></dt></tr></i><div class="hzlj75d" id='npCAJ'><tfoot id='npCAJ'></tfoot><dl id='npCAJ'><fieldset id='npCAJ'></fieldset></dl></div>
                  <tfoot id='npCAJ'></tfoot>

                      <bdo id='npCAJ'></bdo><ul id='npCAJ'></ul>
                        <tbody id='npCAJ'></tbody>

                        1. <legend id='npCAJ'><style id='npCAJ'><dir id='npCAJ'><q id='npCAJ'></q></dir></style></legend>

                          主站蜘蛛池模板: 烽火安全网_加密软件、神盾软件官网| 振动传感器,检波器-威海广达勘探仪器有限公司 | 高效节能电机_伺服主轴电机_铜转子电机_交流感应伺服电机_图片_型号_江苏智马科技有限公司 | pH污水传感器电极,溶解氧电极传感器-上海科蓝仪表科技有限公司 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 石家庄救护车出租_重症转院_跨省跨境医疗转送_活动赛事医疗保障_康复出院_放弃治疗_腾康26年医疗护送转诊团队 | 屏蔽泵厂家,化工屏蔽泵_维修-淄博泵业| 旅游规划_旅游策划_乡村旅游规划_景区规划设计_旅游规划设计公司-北京绿道联合旅游规划设计有限公司 | LED投光灯-工矿灯-led路灯头-工业灯具 - 山东普瑞斯照明科技有限公司 | 垃圾处理设备_餐厨垃圾处理设备_厨余垃圾处理设备_果蔬垃圾处理设备-深圳市三盛环保科技有限公司 | 细砂提取机,隔膜板框泥浆污泥压滤机,螺旋洗砂机设备,轮式洗砂机械,机制砂,圆锥颚式反击式破碎机,振动筛,滚筒筛,喂料机- 上海重睿环保设备有限公司 | 恒压供水控制柜|无负压|一体化泵站控制柜|PLC远程调试|MCGS触摸屏|自动控制方案-联致自控设备 | 全自动面膜机_面膜折叠机价格_面膜灌装机定制_高速折棉机厂家-深圳市益豪科技有限公司 | 二氧化碳/活性炭投加系统,次氯酸钠发生器,紫外线消毒设备|广州新奥 | 氟塑料磁力泵-不锈钢离心泵-耐腐蚀化工泵厂家「皖金泵阀」 | 变色龙云 - 打包app_原生app_在线制作平台_短链接_ip查询 | 透平油真空滤油机-变压器油板框滤油机-滤油车-华之源过滤设备 | 成都亚克力制品,PVC板,双色板雕刻加工,亚克力门牌,亚克力标牌,水晶字雕刻制作-零贰捌广告 | 精密五金冲压件_深圳五金冲压厂_钣金加工厂_五金模具加工-诚瑞丰科技股份有限公司 | 环讯传媒,永康网络公司,永康网站建设,永康小程序开发制作,永康网站制作,武义网页设计,金华地区网站SEO优化推广 - 永康市环讯电子商务有限公司 | 臭氧实验装置_实验室臭氧发生器-北京同林臭氧装置网 | 知名电动蝶阀,电动球阀,气动蝶阀,气动球阀生产厂家|价格透明-【固菲阀门官网】 | 集菌仪厂家_全封闭_封闭式_智能智能集菌仪厂家-上海郓曹 | 物联网卡_物联网卡购买平台_移动物联网卡办理_移动联通电信流量卡通信模组采购平台? | 电机保护器-电动机综合保护器-浙江开民 | 工业洗衣机_工业洗涤设备_上海力净工业洗衣机厂家-洗涤设备首页 bkzzy在职研究生网 - 在职研究生招生信息咨询平台 | 北京环球北美考试院【官方网站】|北京托福培训班|北京托福培训 | 沈飞防静电地板__机房地板-深圳市沈飞防静电设备有限公司 | 水平筛厂家-三轴椭圆水平振动筛-泥沙震动筛设备_山东奥凯诺矿机 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 大数据营销公司_舆情监测软件_上海SEO公司-文军营销官网 | 长沙印刷厂-包装印刷-画册印刷厂家-湖南省日大彩色印务有限公司 青州搬家公司电话_青州搬家公司哪家好「鸿喜」青州搬家 | DWS物流设备_扫码称重量方一体机_快递包裹分拣机_广东高臻智能装备有限公司 | 广州企亚 - 数码直喷、白墨印花、源头厂家、透气无手感方案服务商! | 标准件-非标紧固件-不锈钢螺栓-非标不锈钢螺丝-非标螺母厂家-三角牙锁紧自攻-南京宝宇标准件有限公司 | 桁架楼承板-钢筋桁架楼承板-江苏众力达钢筋楼承板厂 | 桥架-槽式电缆桥架-镀锌桥架-托盘式桥架 - 上海亮族电缆桥架制造有限公司 | 定做大型恒温循环水浴槽-工业用不锈钢恒温水箱-大容量低温恒温水槽-常州精达仪器 | 真空泵维修保养,普发,阿尔卡特,荏原,卡西亚玛,莱宝,爱德华干式螺杆真空泵维修-东莞比其尔真空机电设备有限公司 | H型钢切割机,相贯线切割机,数控钻床,数控平面钻,钢结构设备,槽钢切割机,角钢切割机,翻转机,拼焊矫一体机 | 谷歌关键词优化-外贸网站优化-Google SEO小语种推广-思亿欧外贸快车 | 自恢复保险丝_贴片保险丝_力特保险丝_Littelfuse_可恢复保险丝供应商-秦晋电子 |