瀏覽代碼

Select: Fix memory leak issue (#16463)

Zhi Cun 6 年之前
父節點
當前提交
418ac5bf79
共有 1 個文件被更改,包括 4 次插入0 次删除
  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));
     }
   };