Angular搭配Swiper-分页不工作
创始人
2024-10-24 00:31:32
0
  1. 确保你在 HTML 文件中正确地使用了 Swiper 分页,例如:

  Slide 1
  Slide 2
  Slide 3

  
  1. 在组件文件中引入 ngx-swiper-wrapper 组件:
import { SwiperOptions } from 'swiper';

// ...

export class MyComponent {
  public config: SwiperOptions = {
    // Swiper 分页选项
    pagination: { el: '.swiper-pagination', clickable: true }
  };
}
  1. 在 HTML 文件中使用 ngx-swiper-wrapper 组件:

  {{ item }}

  
  1. 在组件文件中初始化 Swiper:
import { ViewChild, AfterViewInit } from '@angular/core';
import { SwiperComponent } from 'ngx-swiper-wrapper';

// ...

export class MyComponent implements AfterViewInit {
  // 获取 ViewChild 实例
  @ViewChild(SwiperComponent) public componentRef?: SwiperComponent;

  // ...

  public ngAfterViewInit(): void {
    // 等待渲染完成后初始化 Swiper
    setTimeout(() => {
      if (this.componentRef) {
        this.componentRef.swiper().update();
      }
    });
  }
}

相关内容

热门资讯

有了最新消息!wepoker怎... 有了最新消息!wepoker怎么设置房间(透视)切实是有辅助辅助器(有挂秘笈)-哔哩哔哩1、wepo...
透视ai代打!pokemmo手... 透视ai代打!pokemmo手机脚本辅助器(透视)一直是有辅助下载(有挂细节)-哔哩哔哩1、在pok...
记者获悉!wepoker一直输... 记者获悉!wepoker一直输的号能继续打吗(透视)其实真的有辅助安装(有挂方法)-哔哩哔哩暗藏猫腻...
透视规律!hhpoker辅助靠... 透视规律!hhpoker辅助靠谱吗(透视)果然真的有辅助工具(有挂方法)-哔哩哔哩1、实时hhpok...
透视透视!wepoker底牌透... 透视透视!wepoker底牌透视脚本(透视)一贯真的是有辅助修改器(有挂分享)-哔哩哔哩暗藏猫腻,小...
据公告内容!德州透视插件(透视... 据公告内容!德州透视插件(透视)其实是有辅助神器(有挂教学)-哔哩哔哩1、金币登录送、破产送、升级送...
透视存在!wpk私人辅助(透视... 透视存在!wpk私人辅助(透视)一直是真的辅助插件(有挂透明挂)-哔哩哔哩1、进入游戏-大厅左侧-新...
透视系统!wepoker有透视... 透视系统!wepoker有透视底牌吗(透视)确实是真的辅助神器(发现有挂)-哔哩哔哩wepoker有...
最新消息!购买的wpk辅助在哪... 最新消息!购买的wpk辅助在哪里下载(透视)确实真的有辅助平台(有挂细节)-哔哩哔哩1、游戏颠覆性的...
据玩家消息!wpk可以作必弊吗... 据玩家消息!wpk可以作必弊吗(透视)好像真的是有辅助安装(有挂教程)-哔哩哔哩1、wpk可以作必弊...