Skip to content
tonsr edited this page May 19, 2016 · 1 revision

Welcome to the COMMON wiki!

# req.js **异步加载js css文件**

<!DOCTYPE html>
<html>
<head>
     <title></title>
     <script type="text/javascript" src='req.js'></script>
     <script type="text/javascript">
     R.config({
           defined:[
               {jquery:{js:"js/jquery.min.js"}},
               {bootstrap:{js:"js/bootstrap.min.js",css:"css/bootstrap.min.css",rely:["jquery"]}},
               {ztree:{js:"js/jquery.ztree.core.js",css:"css/zTreeStyle.css",rely:["jquery"]}},
               {ztreecheck:{js:"js/jquery.ztree.excheck.js",rely:["ztree"]}},
               {svg:{js:"svg.js",rely:"bootstrap"}}
               ]
     });
     </script>
 </head>
 <body>

 <script type="text/javascript">

R.req('svg.js',function(app){
    app.param={"hello":"xxxx"};
    app.init();
});

</script>
</body>
</html>

***

# svg.js

R(function(){
      this.req("svg");
      this.init=function(){
            console.log(this);
      }
});
Clone this wiki locally