mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
fix(item-sliding): make sure options are ready
This commit is contained in:
@ -37,10 +37,6 @@ ion-item-options {
|
|||||||
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
z-index: $z-index-item-options;
|
z-index: $z-index-item-options;
|
||||||
|
|
||||||
&.hydrated {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-options-start {
|
.item-options-start {
|
||||||
|
@ -67,7 +67,7 @@ export class ItemSliding {
|
|||||||
async componentDidLoad() {
|
async componentDidLoad() {
|
||||||
this.item = this.el.querySelector('ion-item');
|
this.item = this.el.querySelector('ion-item');
|
||||||
|
|
||||||
this.updateOptions();
|
await this.updateOptions();
|
||||||
|
|
||||||
this.gesture = (await import('../../utils/gesture/gesture')).createGesture({
|
this.gesture = (await import('../../utils/gesture/gesture')).createGesture({
|
||||||
el: this.el,
|
el: this.el,
|
||||||
@ -139,7 +139,7 @@ export class ItemSliding {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateOptions() {
|
private async updateOptions() {
|
||||||
const options = this.el.querySelectorAll('ion-item-options');
|
const options = this.el.querySelectorAll('ion-item-options');
|
||||||
|
|
||||||
let sides = 0;
|
let sides = 0;
|
||||||
@ -148,14 +148,14 @@ export class ItemSliding {
|
|||||||
this.leftOptions = this.rightOptions = undefined;
|
this.leftOptions = this.rightOptions = undefined;
|
||||||
|
|
||||||
for (let i = 0; i < options.length; i++) {
|
for (let i = 0; i < options.length; i++) {
|
||||||
const option = options.item(i);
|
const option = await options.item(i).componentOnReady();
|
||||||
|
|
||||||
if (option.side === 'end') {
|
if (option.side === 'start') {
|
||||||
this.rightOptions = option;
|
|
||||||
sides |= ItemSide.End;
|
|
||||||
} else {
|
|
||||||
this.leftOptions = option;
|
this.leftOptions = option;
|
||||||
sides |= ItemSide.Start;
|
sides |= ItemSide.Start;
|
||||||
|
} else {
|
||||||
|
this.rightOptions = option;
|
||||||
|
sides |= ItemSide.End;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.optsDirty = true;
|
this.optsDirty = true;
|
||||||
|
Reference in New Issue
Block a user