1.項目官網地址:http://m.sui.taobao.org/javascript
2.項目使用能夠參考開始使用和示例css
3.項目是放在 Github 上的 https://github.com/sdc-alibaba/SUI-Mobile,咱們能夠使用git 下載到本地 使用grunt 根據須要重構html
4.helloworld:前端
1.新建demo.html 並填充須要的結構java
2.引入須要的cdn 文件git
3.將script放到頁面腳步,調用須要的組件,若是是分別調用須要的js,那麼咱們通常須要引用zepto-adapter.js util.js init.js 以及咱們須要的js組件 在調用的script結尾前可能須要初始化 $.init();github
這裏給一個下拉更新的代碼示例web
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>SUI Mobile Demo</title> <meta name="description" content="MSUI"> <meta name="author" content="阿里巴巴國際UED前端"> <meta name="viewport" content="initial-scale=1, maximum-scale=1"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="format-detection" content="telephone=no"> <!-- Google Web Fonts --> <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css"> <link rel="stylesheet" href="http://m.sui.taobao.org/assets/css/demos.css"> <link rel="stylesheet" href="http://m.sui.taobao.org/assets/css/docs.css"> <script src="http://m.sui.taobao.org/assets/js/zepto.js"></script> </head> <body> <!-- page集合的容器,裏面放多個平行的.page,其餘.page做爲內聯頁面由路由控制展現 --> <div class="page-group"> <!-- 單個page ,第一個.page默認被展現--> <div id="page-ptr" class="page"> <header class="bar bar-nav"> <a class="button button-link button-nav pull-left back" href="/demos"> <span class="icon icon-left"></span> 返回 </a> <h1 class="title">柵格</h1> </header> <div class="content pull-to-refresh-content"> <div class="pull-to-refresh-layer"> <div class="preloader"></div> <div class="pull-to-refresh-arrow"></div> </div> <!-- 下面是正文 --> <div class="card-container"> <div class="card"> <div class="card-header">卡片標題</div> <div class="card-content"> <div class="card-content-inner"> 下拉屏幕試試,會出現更多的卡片 </div> </div> </div> </div> </div> </div> </div> <!-- 默認必需要執行$.init(),實際業務裏通常不會在HTML文檔裏執行,一般是在業務頁面代碼的最後執行 --> <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.js' charset='utf-8'></script> <!-- <script src="http://m.sui.taobao.org/assets/js/demos.js"></script> --> <script> $(function () { 'use strict'; //下拉刷新頁面 $(document).on("pageInit", "#page-ptr", function(e, id, page) { var $content = $(page).find(".content").on('refresh', function(e) { // 模擬2s的加載過程 setTimeout(function() { var cardHTML = '<div class="card">' + '<div class="card-header">標題</div>' + '<div class="card-content">' + '<div class="card-content-inner">內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容內容' + '</div>' + '</div>' + '</div>'; $content.find('.card-container').prepend(cardHTML); // $(window).scrollTop(0); // 加載完畢須要重置 $.pullToRefreshDone($content); }, 2000); }); }); $.init(); }); </script> </body> </html>
啓動從https://github.com/sdc-alibaba/SUI-Mobile 克隆下拉的項目 npm install 之後 jekyll serve 啓動項目npm