Browse Source

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

songchenglin3 5 years ago
parent
commit
2c915f0311

+ 6 - 0
src/packages/circleprogress/circleprogress.vue

@@ -20,6 +20,7 @@
       :stroke="option.progressColor"
       :stroke-dasharray="arcLength"
       :stroke-width="strokeInnerWidth"
+      
       fill="none"
       transform="rotate(-90)"
       transform-origin="center"
@@ -66,6 +67,11 @@ export default {
       // console.log(this.progress,progressLength)
       return `${progressLength},${circleLength}`
     },
+    // :stroke-dashoffset="dashOffset"
+    // dashOffset() {
+    //   // 偏移初始值为dashArray长度,随着percent增大逐渐减小
+    //   return (1 - this.progress) *Math.floor(2 * Math.PI * this.option.radius);
+    // },
     option () {
       // 所有进度条的可配置项
       let baseOption = {

+ 4 - 0
src/packages/countdown/countdown.vue

@@ -156,6 +156,10 @@ const countdownTimer = {
   },
   created() {
     this.initTimer();
+  },
+  destroyed() {
+    this.timer && clearInterval(this.timer);
+    
   }
 }
 countdownTimer.restTime = restTime;

+ 17 - 17
src/packages/countdown/doc.md

@@ -4,7 +4,7 @@
 
 ```html
 <nut-countdown 
-    :endTime="end"  
+    :end-time="end"  
 >
 </nut-countdown>
 ```
@@ -13,8 +13,8 @@
 
 ```html
 <nut-countdown 
-    :endTime="end" 
-    showDays 
+    :end-time="end" 
+    show-days 
 >
 </nut-countdown>
 ```
@@ -23,9 +23,9 @@
 
 ```html
 <nut-countdown 
-    :startTime="serverTime"
-    :endTime="end" 
-    showDays 
+    :start-time="serverTime"
+    :end-time="end" 
+    show-days 
 >
 </nut-countdown>
 ```
@@ -34,9 +34,9 @@
 
 ```html
 <nut-countdown 
-    showDays 
-    showPlainText 
-    :endTime="end" 
+    show-days 
+    show-plain-text 
+    :end-time="end" 
 >
 </nut-countdown>
 ```
@@ -45,9 +45,9 @@
 
 ```html
 <nut-countdown 
-    showDays 
-    showPlainText 
-    :endTime="asyncEnd" 
+    show-days 
+    show-plain-text 
+    :end-time="asyncEnd" 
 >
 </nut-countdown>
 ```
@@ -56,7 +56,7 @@
 
 ```html
 <nut-countdown 
-    :endTime="end" 
+    :end-time="end" 
     :paused="paused" 
 >
 </nut-countdown>
@@ -66,10 +66,10 @@
 
 | 字段 | 说明 | 类型 | 默认值
 | ----- | ----- | ----- | -----
-| startTime | 开始时间 | String, Number | Date.now()
-| endTime | 结束时间 | String, Number | Date.now()
-| showDays | 是否显示天 | Boolean | false
-| showPlainText | 显示为纯文本 | Boolean | false
+| start-time | 开始时间 | String, Number | Date.now()
+| end-time | 结束时间 | String, Number | Date.now()
+| show-days | 是否显示天 | Boolean | false
+| show-plain-text | 显示为纯文本 | Boolean | false
 | paused | 是否暂停 | Boolean | false
 
 

+ 51 - 0
src/packages/drag/__test__/drag.spec.js

@@ -0,0 +1,51 @@
+// import { shallowMount } from "@vue/test-utils";
+// import Drag from "../Drag.vue";
+// import Vue from "vue";
+
+// describe("Drag.vue", () => {
+//   const wrapper = shallowMount(Drag, {});
+//   it("设置x轴拖拽方向", () => {
+//     wrapper.setProps({
+//       direction: "x",
+//     });
+
+//     return Vue.nextTick().then(function() {
+//       expect(wrapper.find(".nut-drag").isVisible()).toBe(true);
+//     });
+//   });
+
+//   it("设置y轴拖拽方向", () => {
+//     wrapper.setProps({
+//       direction: "y",
+//     });
+
+//     return Vue.nextTick().then(function() {
+//       expect(wrapper.find(".nut-drag").isVisible()).toBe(true);
+//     });
+//   });
+
+//   it("设置自动吸边", () => {
+//     wrapper.setProps({
+//       attract: true,
+//     });
+
+//     return Vue.nextTick().then(function() {
+//       expect(wrapper.find(".nut-drag").isVisible()).toBe(true);
+//     });
+//   });
+
+//   it("设置拖拽边界", () => {
+//     wrapper.setProps({
+//       boundary: {
+//         top: 401,
+//         left: 9,
+//         bottom: document.documentElement.clientHeight - 601,
+//         right: document.documentElement.clientWidth - 300 - 9,
+//       },
+//     });
+
+//     return Vue.nextTick().then(function() {
+//       expect(wrapper.find(".nut-drag").isVisible()).toBe(true);
+//     });
+//   });
+// });

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

@@ -59,7 +59,7 @@ export default {
 }
 .touch-dom {
   height: 30px;
-  padding: 10px;
+  padding: 0 10px;
   line-height: 30px;
   text-align: center;
   color: #fff;

+ 1 - 0
src/packages/searchbar/demo.vue

@@ -36,6 +36,7 @@
             <nut-searchbar
 		        placeText="请输入自定义文案"
 		        @submit="search"
+				@focus="focusFun"
 				ref="myInput"
 	        ></nut-searchbar>
         </div>

+ 1 - 0
src/packages/searchbar/doc.md

@@ -51,6 +51,7 @@
 <nut-searchbar
     placeText="请输入自定义文案"
     @submit="search"
+    @focus="focusFun"
     ref="myInput"
 ></nut-searchbar>
 ```

+ 3 - 0
src/packages/searchbar/searchbar.vue

@@ -10,6 +10,7 @@
 					@keyup.enter="submitFun"
 					@input="inputFun"
 					@blur="blurFun"
+					@focus="focusFun"
 					ref="searchInput"
 	    		>
 	    		<span class="close-icon" :class="hasCloseIcon ? 'show':''"
@@ -102,6 +103,7 @@ export default {
     		this.hasCloseIcon = false;
     	},
     	focusFun() {
+			
     		this.inputFocusAnimation = true;
     		this.$emit('focus');
     	},
@@ -122,6 +124,7 @@ export default {
 		},
 		//js控制获取焦点
 		focus() {
+		
 			this.$nextTick(function() {
 				this.$refs.searchInput.focus()
 			})

+ 1 - 1
src/packages/stepper/__test__/stepper.spec.js

@@ -18,7 +18,7 @@ describe('Stepper.vue', () => {
         });
         const input = wraper.find('input');
         expect(wraper.contains('.nut-stepper-grey')).toBe(true);
-        expect(input.attributes('min')).toBe('0');
+        expect(input.attributes('min')).toBe('10');
         expect(input.attributes('max')).toBe(maxVal);
     });
 

+ 8 - 0
src/packages/stepper/stepper.vue

@@ -117,6 +117,14 @@ export default {
                 this.$emit('change', this.num);
             },
             immediate: true
+        },
+        min:{
+            handler(v, ov) {
+                if(v < this.max){
+                    this.minNum = v
+                }
+            },
+            immediate: true
         }
     },
     computed: {