Browse Source

Merge branch 'v2' of https://github.com/jdf2e/nutui into v2

famanoder 6 years ago
parent
commit
920b8b0055

+ 12 - 0
CHANGELOG.md

@@ -1,3 +1,15 @@
+## 2.0.4
+
+`2019-3-12`
+
+* :sparkles: 新增构建CommonJS包
+* :sparkles: 新增倒计时`CountDown`组件
+* :bug: 修复`Rate`组件样式兼容问题
+* :bug: 修复两个组件测试用例问题
+* :zap: 优化`Swiper`组件
+* :zap: 文档增加目录功能
+* :zap: 新增英文版README.md
+
 ## 2.0.3
 
 `2019-1-25`

+ 8 - 2
docs/intro.md

@@ -36,9 +36,15 @@ NutUI是一套京东风格的移动端Vue组件库,开发和服务于移动Web
 * iOS 8.0+
 * 支持服务端渲染
 
-## 版本
+## 构建版本
 
-* 稳定版:![npm](https://img.shields.io/npm/v/@nutui/nutui.svg)
+* UMD版 nutui.js
+* UMD压缩版 nutui.min.js
+* CommonJS版 nutui.common.js
+
+> AMD 环境、Webpack 等构建工具环境建议使用 UMD 版,非模块化环境(通过 `<script>` 标签直接引用)建议使用 UMD 压缩版,服务端渲染请使用 CommonJS 版本。
+
+最新稳定版:![npm](https://img.shields.io/npm/v/@nutui/nutui.svg)
 
 > 你还可以订阅: https://github.com/jdf2e/nutui/releases.atom 来获得稳定版发布的通知。
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@nutui/nutui",
-  "version": "2.0.3",
+  "version": "2.0.4",
   "description": "一套轻量级移动端Vue组件库",
   "typings": "dist/types/index.d.ts",
   "main": "dist/nutui.js",

+ 12 - 38
sites/doc/asset/css/common.scss

@@ -136,10 +136,9 @@ pre {
     position: relative;
     max-width: 100%;
     overflow: auto;
-    margin
-    .code-wrapper{
-        width:100%;
-        overflow:auto;
+    margin .code-wrapper {
+        width: 100%;
+        overflow: auto;
     }
     [toast="toast"],
     [copy="copy"] {
@@ -259,33 +258,11 @@ pre {
         max-width: 100%;
         max-height: 800px;
         overflow: auto;
-        &>i,.lang {
+        &>i,
+        .lang {
             display: none;
         }
-    } // .kwd{
-    //     color:#ffb560;;
-    // }
-    // .pln{
-    //     color: #3d74ff;
-    // }
-    // .tag{
-    //     color:#288cff;
-    // }
-    // .atn{
-    //     color:#0dade4;
-    // }
-    // .pun{
-    //     color: #fff;
-    // }
-    // .atv{
-    //     color: #005cc5;
-    // }
-    // .com{
-    //     color :#055a2a;
-    // }
-    // .str{
-    //     color: #fff;
-    // }
+    }
 }
 
 pre.prettyprint {
@@ -293,19 +270,16 @@ pre.prettyprint {
         font: 13px/24px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
     }
 }
+
 // 书签样式
-.markList{
+.markList {
     position: fixed;
     right: 10px;
     top: 100px;
     background: #fff;
-    border:1px solid #efefef;
-    padding:10px 10px 10px 20px!important;    
-    border-right: none;
-    li:before{
-        display: none!important;
-        
+    border-left: 1px solid #efefef;
+    padding: 0 10px 0 20px !important;
+    li:before {
+        display: none !important;
     }
-    
-    
 }

+ 7 - 9
sites/doc/asset/css/style-blue.scss

@@ -1,7 +1,6 @@
 .doc-cont {
     margin: 0 0 0 60px;
     position: relative;
-   
     h1 {
         font-size: 30px;
         font-weight: 700;
@@ -180,16 +179,15 @@
         }
     }
 }
-// 书签样式
-.markList{      
 
-    a{
-        color:#666;
+// 书签样式
+.markList {
+    a {
+        color: #666;
     }
-    .cur{
-        a{
-            color:#5396ff;
+    .cur {
+        a {
+            color: #5396ff;
         }
-       
     }
 }

+ 1 - 1
src/packages/price/demo.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="demo-list">
     <h4>基本用法</h4>
-    <p>无人民符号,有千位分隔</p>
+    <p>无人民符号,有千位分隔</p>
     <div>
       <nut-cell>
         <span slot="title">

+ 23 - 5
src/packages/swiper/swiper.vue

@@ -201,9 +201,14 @@ export default {
         },
         _onTouchMove(e){
             if(!this.dragging) return;
-            this.delta = this._getTouchPos(e) - this.startPos;
-            let  isQuickAction = (new Date().getTime() - this.startTime) < 200;
-            if(this.canDragging && !isQuickAction){
+            if(this.isHorizontal()){
+                this.delta = this._getTouchPos(e).x - this.startPos.x;
+            }else{
+                this.delta = this._getTouchPos(e).y - this.startPos.y;
+            }
+            //let  isQuickAction = (new Date().getTime() - this.startTime) < 200;
+            if(this.canDragging && this._computePreventDefault(e)){
+                e.preventDefault();
                 this.lazyLoad && this._imgLazyLoad();
                 this._setTranslate(this.startTranslate + this.delta);
                 this.$emit('slideMove',this._getTranslate(),this.$el);
@@ -229,9 +234,22 @@ export default {
         _revert(){
             this.setPage(this.currentPage,true);
         },
+         _computePreventDefault(e){
+            let pos = this._getTouchPos(e);
+            let xDis = Math.abs(this.startPos.x - pos.x);
+            let yDis = Math.abs(this.startPos.y - pos.y);
+            if ( xDis <= 5 && xDis >=0){
+                return false;
+            }else if( yDis > 5 && yDis/xDis > 0.5 ){
+                return false;
+            }else{
+                return true;
+            }
+        },
         _getTouchPos(e){
-            let key = this.isHorizontal() ?'pageX':'pageY';
-            return e.changedTouches ? e.changedTouches[0][key] :e[key];
+            let x = e.changedTouches ? e.changedTouches[0]['pageX'] :e['pageX'];
+            let y = e.changedTouches ? e.changedTouches[0]['pageY'] :e['pageY'];
+            return {x,y}
         },
         _onTransitionStart(type){
             this.transitionDuration = this.speed;

+ 1 - 0
types/nutui.d.ts

@@ -46,6 +46,7 @@ export declare class TabPanel extends UIComponent {}
 export declare class Toast extends UIComponent {}
 export declare class BackTop extends UIComponent {}
 export declare class Scroller extends UIComponent {}
+export declare class CountDown extends UIComponent {}
 
 export interface InstallationOptions {
     locale?: any