Explorar o código

add two warns

Leopoldthecoder %!s(int64=8) %!d(string=hai) anos
pai
achega
601bd6469b
Modificáronse 2 ficheiros con 10 adicións e 0 borrados
  1. 5 0
      packages/form/src/form.vue
  2. 5 0
      packages/slider/src/main.vue

+ 5 - 0
packages/form/src/form.vue

@@ -52,6 +52,11 @@
     },
     methods: {
       resetFields() {
+        if (!this.model) {
+          process.env.NODE_ENV !== 'production' &&
+          console.warn('[Element Warn][Form]model is required for resetFields to work.');
+          return;
+        }
         this.fields.forEach(field => {
           field.resetField();
         });

+ 5 - 0
packages/slider/src/main.vue

@@ -237,6 +237,11 @@
       },
 
       stops() {
+        if (this.step === 0) {
+          process.env.NODE_ENV !== 'production' &&
+          console.warn('[Element Warn][Slider]step should not be 0.');
+          return [];
+        }
         const stopCount = (this.max - this.min) / this.step;
         const stepWidth = 100 * this.step / (this.max - this.min);
         const result = [];