mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix(all): component reusage (#18963)
Use new stencil APIs to allow ionic elements to be reused once removed from the DOM. fixes #18843 fixes #17344 fixes #16453 fixes #15879 fixes #15788 fixes #15484 fixes #17890 fixes #16364
This commit is contained in:
@ -152,16 +152,14 @@ export class VirtualScroll implements ComponentInterface {
|
||||
this.updateVirtualScroll();
|
||||
}
|
||||
|
||||
async componentDidLoad() {
|
||||
async connectedCallback() {
|
||||
const contentEl = this.el.closest('ion-content');
|
||||
if (!contentEl) {
|
||||
console.error('virtual-scroll must be used inside ion-content');
|
||||
console.error('<ion-virtual-scroll> must be used inside an <ion-content>');
|
||||
return;
|
||||
}
|
||||
await contentEl.componentOnReady();
|
||||
|
||||
this.contentEl = contentEl;
|
||||
this.scrollEl = await contentEl.getScrollElement();
|
||||
this.contentEl = contentEl;
|
||||
this.calcCells();
|
||||
this.updateState();
|
||||
}
|
||||
@ -170,7 +168,7 @@ export class VirtualScroll implements ComponentInterface {
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
componentDidUnload() {
|
||||
disconnectedCallback() {
|
||||
this.scrollEl = undefined;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user