zoukankan      html  css  js  c++  java
  • RequireJs学习

    require会定义三个变量:define,require,requirejs,其中require === requirejs,
    其中Define是api的一个模块
     
    Require.config用来配置模块加载的位置,
    require.config({
    paths : { "jquery" : ["http://libs.baidu.com/jquery/2.0.3/jquery", "js/jquery"], "a" : "js/a" }
    //非AMD模块输出,将非标准的AMD模块"垫"成可用的模块,例如:在老版本的jquery中,是没有继承AMD规范的,所以不能直接require["jquery"],这时候就需要shim,比如我要是用underscore类库,但是他并没有实现AMD规范,那我们可以这样配置
    shim:{
    "underscore":{
    exports:"_";
    }
    }
    })
    给每个模块起一个别名,这样在
    require的时候就可以require(["别名","underscore",“js/a”],function($,_){
    $(functioin(){
    alert("只是个回调函数");
    _.each([1,2,3],alert);
    })
    })
     
    RequireJs在Asp.Net 中的应用
     
    requirejs配置模块加载
    requirejs.config({ paths: {       "jquery": "/js/jquery.min", "bootstrap": "/js/bootstrap"     },     shim: { 'bootstrap': { deps: ['jquery'], exports: "jQuery.fn.popover" }     }   });
     
    然后在home.js在引用时:
     
    require(['../config'], function () { require(['home.index2']); }) , define("home.index2", ['jquery', 'bootstrap'], function () { //main module code here })
     
  • 相关阅读:
    R语言-基本图形
    R语言-基本数据管理
    R语言—图像初阶
    R语言-实用数据对象处理函数
    R语言-数据结构
    scipy 的K-means
    python 解析命令行
    读取视频
    skimage
    face_recognition
  • 原文地址:https://www.cnblogs.com/fuGuy/p/7912903.html
Copyright © 2011-2022 走看看