Browse Source

upd: popup prettier fix

richard1015 5 years ago
parent
commit
836768e334
3 changed files with 28 additions and 29 deletions
  1. 3 3
      src/packages/popup/demo.vue
  2. 4 4
      src/packages/popup/overlay/overlay.vue
  3. 21 22
      src/packages/popup/popup.vue

+ 3 - 3
src/packages/popup/demo.vue

@@ -57,14 +57,14 @@ export default {
       showRound: false,
       showRound: false,
       showIconPosition: false,
       showIconPosition: false,
       showCloseIcon: false,
       showCloseIcon: false,
-      getContainer: false,
+      getContainer: false
     };
     };
   },
   },
   methods: {
   methods: {
     show() {
     show() {
       this.isShow = true;
       this.isShow = true;
-    },
-  },
+    }
+  }
 };
 };
 </script>
 </script>
 <style lang="scss" scoped></style>
 <style lang="scss" scoped></style>

+ 4 - 4
src/packages/popup/overlay/overlay.vue

@@ -33,15 +33,15 @@ const overlayProps = {
   },
   },
   overlayClass: {
   overlayClass: {
     type: String,
     type: String,
-    default: '',
+    default: ''
   },
   },
   overlayStyle: {
   overlayStyle: {
     type: Object,
     type: Object,
-    default: () => {},
+    default: () => {}
   },
   },
   zIndex: {
   zIndex: {
-    type: Number,
-  },
+    type: Number
+  }
 };
 };
 export { overlayProps };
 export { overlayProps };
 export default {
 export default {

+ 21 - 22
src/packages/popup/popup.vue

@@ -34,48 +34,48 @@ const overflowScrollReg = /scroll|auto/i;
 const popupProps = {
 const popupProps = {
   position: {
   position: {
     type: String,
     type: String,
-    default: 'center',
+    default: 'center'
   },
   },
 
 
   transition: String,
   transition: String,
 
 
   closeable: {
   closeable: {
     type: Boolean,
     type: Boolean,
-    default: false,
+    default: false
   },
   },
   closeIconPosition: {
   closeIconPosition: {
     type: String,
     type: String,
-    default: 'top-right',
+    default: 'top-right'
   },
   },
   closeIcon: {
   closeIcon: {
     type: String,
     type: String,
-    default: 'cross',
+    default: 'cross'
   },
   },
 
 
   closeOnClickOverlay: {
   closeOnClickOverlay: {
     type: Boolean,
     type: Boolean,
-    default: true,
+    default: true
   },
   },
 
 
   destroyOnClose: {
   destroyOnClose: {
     type: Boolean,
     type: Boolean,
-    default: false,
+    default: false
   },
   },
   getContainer: String,
   getContainer: String,
   round: {
   round: {
     type: Boolean,
     type: Boolean,
-    default: false,
-  },
+    default: false
+  }
 };
 };
 export default {
 export default {
   name: 'nut-popup',
   name: 'nut-popup',
   mixins: [touchMixins],
   mixins: [touchMixins],
   components: {
   components: {
-    icon: Icon,
+    icon: Icon
   },
   },
   props: {
   props: {
     ...overlayProps,
     ...overlayProps,
-    ...popupProps,
+    ...popupProps
   },
   },
   created() {
   created() {
     this.transition ? (this.transitionName = this.transition) : (this.transitionName = `popup-slide-${this.position}`);
     this.transition ? (this.transitionName = this.transition) : (this.transitionName = `popup-slide-${this.position}`);
@@ -111,19 +111,19 @@ export default {
       val === 'center' ? (this.transitionName = 'popup-fade') : (this.transitionName = `popup-slide-${this.position}`);
       val === 'center' ? (this.transitionName = 'popup-fade') : (this.transitionName = `popup-slide-${this.position}`);
     },
     },
     getContainer: 'portal',
     getContainer: 'portal',
-    overlay: 'renderOverlay',
+    overlay: 'renderOverlay'
   },
   },
   data() {
   data() {
     return {
     return {
       showSlot: true,
       showSlot: true,
       transitionName: 'popup-fade-center',
       transitionName: 'popup-fade-center',
-      overlayInstant: null,
+      overlayInstant: null
     };
     };
   },
   },
   computed: {
   computed: {
     transitionDuration() {
     transitionDuration() {
       return this.duration ? this.duration + 's' : 'initial';
       return this.duration ? this.duration + 's' : 'initial';
-    },
+    }
   },
   },
 
 
   methods: {
   methods: {
@@ -131,7 +131,7 @@ export default {
       if (this.opened) {
       if (this.opened) {
         return;
         return;
       }
       }
-      if(this.destroyOnClose){
+      if (this.destroyOnClose) {
         this.showSlot = true;
         this.showSlot = true;
       }
       }
       this.opened = true;
       this.opened = true;
@@ -144,7 +144,7 @@ export default {
         overlayClass,
         overlayClass,
         overlayStyle,
         overlayStyle,
         lockScroll,
         lockScroll,
-        closeOnClickOverlay,
+        closeOnClickOverlay
       };
       };
 
 
       this.renderOverlay(config);
       this.renderOverlay(config);
@@ -206,13 +206,12 @@ export default {
         if (!overlayManager.lockCount) {
         if (!overlayManager.lockCount) {
           document.body.classList.remove('nut-overflow-hidden');
           document.body.classList.remove('nut-overflow-hidden');
         }
         }
-      } 
-      if(this.destroyOnClose){
-        setTimeout(()=>{
+      }
+      if (this.destroyOnClose) {
+        setTimeout(() => {
           this.showSlot = false;
           this.showSlot = false;
-        },this.duration*1000)        
+        }, this.duration * 1000);
       }
       }
-      
 
 
       overlayManager.closeOverlay(this);
       overlayManager.closeOverlay(this);
       this.$emit('input', false);
       this.$emit('input', false);
@@ -235,8 +234,8 @@ export default {
       if (container && container !== el.parentNode) {
       if (container && container !== el.parentNode) {
         container.appendChild(el);
         container.appendChild(el);
       }
       }
-    },
-  },
+    }
+  }
 };
 };
 export { popupProps };
 export { popupProps };
 </script>
 </script>