全部開發的js功能都必須以AMD規範來定義:javascript
//AMD規範定義組件 define(['zepto'],function ($,config) { //TODO });
全部的功能引用都以AMD規範實現:java
//AMD規範使用 require(['plugins/zepto','plugins/swipe'],function ($, swipe) { //切圖滑動功能 window.mySwipe = new Swipe(document.getElementById('slider'), { startSlide: 2, speed: 400, auto: 6000, continuous: true, disableScroll: false, stopPropagation: false, callback: function(index, elem) {}, transitionEnd: function(index, elem) {} }); });
!中括號裏面寫所引用的js 路徑ide