Browse Source

Select: Fix memory leak issue (#16463)

Zhi Cun 6 years ago
parent
commit
418ac5bf79
1 changed files with 4 additions and 0 deletions
  1. 4 0
      packages/select/src/option.vue

+ 4 - 0
packages/select/src/option.vue

@@ -153,6 +153,10 @@
     },
 
     beforeDestroy() {
+      let index = this.select.cachedOptions.indexOf(this);
+      if (index > -1) {
+        this.select.cachedOptions.splice(index, 1);
+      }
       this.select.onOptionDestroy(this.select.options.indexOf(this));
     }
   };