mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
fix(prerender): local references to window/document
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Component, Listen, Method } from '@stencil/core';
|
||||
import { Component, Listen, Method, Prop } from '@stencil/core';
|
||||
import { PickerOptions } from '../../index';
|
||||
import { OverlayController, createOverlay, dismissOverlay, getTopOverlay, removeLastOverlay } from '../../utils/overlays';
|
||||
|
||||
@ -10,6 +10,8 @@ export class PickerController implements OverlayController {
|
||||
|
||||
private pickers = new Map<number, HTMLIonPickerElement>();
|
||||
|
||||
@Prop({ context: 'document' }) doc: Document;
|
||||
|
||||
@Listen('body:ionPickerWillPresent')
|
||||
protected pickerWillPresent(ev: any) {
|
||||
this.pickers.set(ev.target.overlayId, ev.target);
|
||||
@ -31,7 +33,7 @@ export class PickerController implements OverlayController {
|
||||
*/
|
||||
@Method()
|
||||
create(opts?: PickerOptions): Promise<HTMLIonPickerElement> {
|
||||
return createOverlay(document.createElement('ion-picker'), opts);
|
||||
return createOverlay(this.doc.createElement('ion-picker'), opts);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user