• RequireJS


    npm install -g tnpm@2.4.0 --registry=http://registry.npm.alibaba-inc.com

    http://segmentfault.com/a/1190000000492238

    http://www.cnblogs.com/snandy/archive/2012/05/22/2513652.html

    http://www.ruanyifeng.com/blog/2012/11/require_js.html

    http://www.cnblogs.com/yexiaochai/p/3214926.html

    RequireJS与AngularJS的集成

    http://segmentfault.com/a/1190000000492238

     http://stackoverflow.com/questions/13377373/shim-twitter-bootstrap-for-requirejs

    require.config({
        paths: {
            /* other paths are omitted */
            'bootstrap': '../libs/bootstrap'
        },
        shim: {
            'bootstrap/bootstrap-slider': { deps: ['jquery'], exports: '$.fn.slider' }, 
            'bootstrap/bootstrap-affix': { deps: ['jquery'], exports: '$.fn.affix' },
            'bootstrap/bootstrap-alert': { deps: ['jquery'], exports: '$.fn.alert' },
            'bootstrap/bootstrap-button': { deps: ['jquery'], exports: '$.fn.button' },
            'bootstrap/bootstrap-carousel': { deps: ['jquery'], exports: '$.fn.carousel' },
            'bootstrap/bootstrap-collapse': { deps: ['jquery'], exports: '$.fn.collapse' },
            'bootstrap/bootstrap-dropdown': { deps: ['jquery'], exports: '$.fn.dropdown' },
            'bootstrap/bootstrap-modal': { deps: ['jquery'], exports: '$.fn.modal' },
            'bootstrap/bootstrap-popover': { deps: ['jquery'], exports: '$.fn.popover' },
            'bootstrap/bootstrap-scrollspy': { deps: ['jquery'], exports: '$.fn.scrollspy'        },
            'bootstrap/bootstrap-tab': { deps: ['jquery'], exports: '$.fn.tab' },
            'bootstrap/bootstrap-tooltip': { deps: ['jquery'], exports: '$.fn.tooltip' },
            'bootstrap/bootstrap-transition': { deps: ['jquery'], exports: '$.support.transition' },
            'bootstrap/bootstrap-typeahead': { deps: ['jquery'], exports: '$.fn.typeahead'  },
        }
    });
    
    require(['domReady', 'app'], function(domReady, app) {
        domReady(function() {
            app.init();
        });
    });
    

      

    define(['jquery', 'underscore', 'backbone', 'text!templates/photos-list.html'], function($, _, Backbone, html) {
        var PhotosListView = Backbone.View.extend({
            viewImageFullscreen: function(e) {
                e.preventDefault();
    
                require(['bootstrap/bootstrap-modal', 'text!templates/photo-modal.html'], function(modal, htmlModal) {
                     var modalTemplate = _.template(htmlModal, options);
                     $('body').append(modalTemplate);
    
                     // setup
                     $(selector + '_modal').modal({
                         backdrop: true,
                         keyboard: true,
                         show: false
                     }).css({
                         'width': function() { return ($(document).width() * 0.55) + 'px'; },
                         'margin-left': function() { return -($(this).width() * 0.5); }
                     });
    
                     // trigger `modal` 
                     $(selector + '_modal').modal('show');
                 }); // require() call
             // ...
  • 相关阅读:
    Eclipse连接MySQL数据库(傻瓜篇)
    JMeter监控内存及CPU ——plugin插件监控被测系统资源方法
    fiddler抓取手机端的数据流量包
    python 字典(dictionary)一些方法
    python 循环语句
    Charles 抓 HTTPS 包
    python RSA 加密与签名
    从零开始做一个Jmeter性能测试
    [python之路]变量和字符编码
    [python之路]简单介绍
  • 原文地址:https://www.cnblogs.com/danghuijian/p/4673356.html
Copyright © 2020-2023  润新知