【发布时间】:2020-05-20 03:57:40
【问题描述】:
在进行了一些 API 调用后,我正在尝试初始化我的 Swiper 容器。但是,当我这样做时,我得到了错误:
元素类型上不存在属性“swiper”。
这里是 Swiper API 的链接:Swiperjs
ngOnInit() {
this.spinner.show().then( async () => {
this.data.currentProgress.subscribe(progress => this.progress = progress);
await this.eventService.fetchEvents();
}).then(async () => {
const mySwiper = document.querySelector('.swiper-container').swiper;
mySwiper.init();
}).then(() => {
this.spinner.hide();
});
}
【问题讨论】: