mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix problem page react unmount
This commit is contained in:
1 parent
e2415a75c3
commit
35b0463173
6 files changed
+9
-16
No files matched your search
@@ -24,6 +24,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
||||
ref = null;
|
||||
container = document.createElement('div');
|
||||
options: AutoCompleteOptions;
|
||||
component = ReactDOM.createRoot(this.container);
|
||||
changeListener = [
|
||||
(val) => this.$dom.val(val),
|
||||
];
|
||||
@@ -64,7 +65,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
||||
|
||||
attach() {
|
||||
const value = this.$dom.val();
|
||||
ReactDOM.createRoot(this.container).render(
|
||||
this.component.render(
|
||||
<AutoCompleteFC
|
||||
ref={(ref) => { this.ref = ref; }}
|
||||
height="34px"
|
||||
@@ -97,7 +98,7 @@ export default class AutoComplete extends DOMAttachedObject {
|
||||
detach() {
|
||||
if (this.detached) return;
|
||||
super.detach();
|
||||
ReactDOM.unmountComponentAtNode(this.container);
|
||||
this.component.unmount();
|
||||
this.$dom.removeClass('autocomplete-dummy');
|
||||
this.container.parentNode.removeChild(this.container);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user