Skip to content

Commit

Permalink
refactor: vue-resize memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
cn-xufei committed Dec 12, 2024
1 parent 73be0c6 commit 5c46469
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
"@formily/vue": "2.2.13",
"vue-demi": "^0.12.1",
"vue": "~2.6.14",
"vue-template-compiler": "~2.6.11"
"vue-template-compiler": "~2.6.11",
"vue-resize": "^0.5.0"
},
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
Expand Down
23 changes: 22 additions & 1 deletion patches/[email protected]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/lib/element-ui.common.js b/lib/element-ui.common.js
index 01026cd93f233f08c0f77c1eeffc43b7953ea75e..3f5486798f53c03f57fdfc15b9d8547d97c7fa09 100644
index 01026cd93f233f08c0f77c1eeffc43b7953ea75e..36f72d1f0159768e1b68a7a3cba355e72578c51d 100644
--- a/lib/element-ui.common.js
+++ b/lib/element-ui.common.js
@@ -21781,18 +21781,7 @@ main.directive = directive;
Expand All @@ -22,6 +22,27 @@ index 01026cd93f233f08c0f77c1eeffc43b7953ea75e..3f5486798f53c03f57fdfc15b9d8547d
Object(dom_["on"])(this.referenceElm, 'blur', this.handleBlur);
Object(dom_["on"])(this.referenceElm, 'click', this.removeFocusing);
}
@@ -21825,8 +21814,18 @@ main.directive = directive;
this.debounceClose();
},
handleFocus: function handleFocus() {
- this.focusing = true;
- this.show();
+ if (!this.$slots.default || !this.$slots.default.length) {
+ this.focusing = true;
+ this.show();
+ return;
+ }
+ var instance = this.$slots.default[0].componentInstance;
+ if (instance && instance.focus) {
+ instance.focus();
+ } else {
+ this.focusing = true;
+ this.show();
+ }
},
handleBlur: function handleBlur() {
this.focusing = false;
diff --git a/packages/tooltip/src/main.js b/packages/tooltip/src/main.js
index 6b700bba8f38691d738927e75423d9a902fe245e..57a3e640c05b19c205817e5d3608bb8623a51a1c 100644
--- a/packages/tooltip/src/main.js
Expand Down
29 changes: 19 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5c46469

Please sign in to comment.