标签:
必须要先引入sea.js文件
<script src="js/sea.js"></script>
其次,引入其他js文件
1 <script> 2 seajs.config({ 3 alias: { 4 "layer": "layer/layer.js", 5 "jsRender": "jquery.jsRender.min.js", 6 "dataInfo": "dataInfo.js", 7 "WdatePicker":"My97DatePicker4.8/WdatePicker.js" 8 },preload:["layer","jsRender","dataInfo","WdatePicker"] 9 }); 10 seajs.use("changan.js"); 11 </script>
封装的js文件必须以define定义
1 define(function(){ 2 var mainMoudle={ 3 initEvent:function(){ 4 mainMoudle.query(); 5 }, 6 query:function(){ 7 //操作 8 }, 9 clickEvent:function(){ 10 $().click(function(){}); 11 } 12 main:function(){ 13 mainMoudle.initEvent(); 14 } 15 }; 16 $(function(){ 17 mainMoudle.main(); 18 }) 19 });
标签:
原文地址:http://www.cnblogs.com/sirlhuang/p/5779348.html