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>

                          主站蜘蛛池模板: 大型工业风扇_工业大风扇_大吊扇_厂房车间降温-合昌大风扇 | Win10系统下载_32位/64位系统/专业版/纯净版下载 | 澳门精准正版免费大全,2025新澳门全年免费,新澳天天开奖免费资料大全最新,新澳2025今晚开奖资料,新澳马今天最快最新图库-首页-东莞市傲马网络科技有限公司 | 产业规划_产业园区规划-产业投资选址及规划招商托管一体化服务商-中机院产业园区规划网 | 江苏南京多语种翻译-专业翻译公司报价-正规商务翻译机构-南京华彦翻译服务有限公司 | 深圳彩钢板_彩钢瓦_岩棉板_夹芯板_防火复合彩钢板_长鑫 | 医学模型生产厂家-显微手术模拟训练器-仿真手术模拟训练系统-北京医教科技 | 石磨面粉机|石磨面粉机械|石磨面粉机组|石磨面粉成套设备-河南成立粮油机械有限公司 | 工控机-工业平板电脑-研华工控机-研越无风扇嵌入式box工控机 | 河北凯普威医疗器材有限公司,高档轮椅系列,推车系列,座厕椅系列,协步椅系列,拐扙系列,卫浴系列 | 江苏远邦专注皮带秤,高精度皮带秤,电子皮带秤研发生产 | U拓留学雅思一站式服务中心_留学申请_雅思托福培训 | led冷热冲击试验箱_LED高低温冲击试验箱_老化试验箱-爱佩百科 | 北京翻译公司-专业合同翻译-医学标书翻译收费标准-慕迪灵 | 河南道路标志牌_交通路标牌_交通标志牌厂家-郑州路畅交通 | 电梯装饰-北京万达中意电梯装饰有限公司 | 成都LED显示屏丨室内户外全彩led屏厂家方案报价_四川诺显科技 | 粉末冶金-粉末冶金齿轮-粉末冶金零件厂家-东莞市正朗精密金属零件有限公司 | 南京泽朗生物科技有限公司-液体饮料代加工_果汁饮料代加工_固体饮料代加工 | 成人纸尿裤,成人尿不湿,成人护理垫-山东康舜日用品有限公司 | 房间温控器|LonWorks|海思| 武汉创亿电气设备有限公司_电力检测设备生产厂家 | 丹尼克尔拧紧枪_自动送钉机_智能电批_柔性振动盘_螺丝供料器品牌 | 购买舔盐、舔砖、矿物质盐压块机,鱼饵、鱼饲料压块机--请到杜甫机械 | 流量卡中心-流量卡套餐查询系统_移动电信联通流量卡套餐大全 | 金刚网,金刚网窗纱,不锈钢网,金刚网厂家- 河北萨邦丝网制品有限公司 | 小青瓦丨古建筑瓦丨青瓦厂家-宜兴市徽派古典建筑材料有限公司 | 骨密度仪-骨密度测定仪-超声骨密度仪-骨龄测定仪-天津开发区圣鸿医疗器械有限公司 | 电动葫芦|防爆钢丝绳电动葫芦|手拉葫芦-保定大力起重葫芦有限公司 | 温州中研白癜风专科_温州治疗白癜风_温州治疗白癜风医院哪家好_温州哪里治疗白癜风 | 屏蔽服(500kv-超高压-特高压-电磁)-徐吉电气 | 工业雾炮机_超细雾炮_远程抑尘射雾器-世纪润德环保设备 | 工业铝型材生产厂家_铝合金型材配件批发精加工定制厂商 - 上海岐易铝业 | 中天寰创-内蒙古钢结构厂家|门式刚架|钢结构桁架|钢结构框架|包头钢结构煤棚 | 不锈钢发酵罐_水果酒发酵罐_谷物发酵罐_山东誉诚不锈钢制品有限公司 | 华夏医界网_民营医疗产业信息平台_民营医院营销管理培训 | TPU薄膜_TPU薄膜生产厂家_TPU热熔胶膜厂家定制_鑫亘环保科技(深圳)有限公司 | 无纺布包装机|径向缠绕包装机|缠绕膜打包机-上海晏陵智能设备有限公司 | 不锈钢螺丝 - 六角螺丝厂家 - 不锈钢紧固件 - 万千紧固件--紧固件一站式采购 | 胶泥瓷砖胶,轻质粉刷石膏,嵌缝石膏厂家,腻子粉批发,永康家德兴,永康市家德兴建材厂 | 插针变压器-家用电器变压器-工业空调变压器-CD型电抗器-余姚市中驰电器有限公司 |