离子滑块在 ModalController ionic 4 中不起作用
ion slider not working in ModalController ionic 4
版本:
科尔多瓦:cordova-lib@8.1.1
离子:6.10.1
错误:this.slider.update is not a function
在 .ts 中
import { ModalController, IonSlides } from "@ionic/angular";
trainingSliderOpts = {
speed: 400,
initialSlide: 0,
preloadImages: true,
allowTouchMove: false,
};
result: any;
@ViewChild("trainingSlider", { static: true }) slider: IonSlides;
ionViewDidEnter() {
this.slider.update();
}
尝试在最后添加一个 .then 函数:
this.ionSlides.update().then(() =>
console.log('updated'))
}
如果不起作用,请在 class 之上尝试以下操作:
@ViewChild('slider', {read: ElementRef})slider: ElementRef;
然后这样称呼它:
this.slider.nativeElement.update();
版本: 科尔多瓦:cordova-lib@8.1.1 离子:6.10.1
错误:this.slider.update is not a function
在 .ts 中
import { ModalController, IonSlides } from "@ionic/angular";
trainingSliderOpts = {
speed: 400,
initialSlide: 0,
preloadImages: true,
allowTouchMove: false,
};
result: any;
@ViewChild("trainingSlider", { static: true }) slider: IonSlides;
ionViewDidEnter() {
this.slider.update();
}
尝试在最后添加一个 .then 函数:
this.ionSlides.update().then(() =>
console.log('updated'))
}
如果不起作用,请在 class 之上尝试以下操作:
@ViewChild('slider', {read: ElementRef})slider: ElementRef;
然后这样称呼它:
this.slider.nativeElement.update();