我的问题是关于使用 Swiper http://idangero.us 和 ionic 4

My questions is about using Swiper http://idangero.us, with ionic 4

我通过在 cli 中安装 Swiper 来设置它。 css 样式工作正常,但缺少功能(滑动)。当我尝试遵循源代码时,这个对象声明为 "new Swiper",但我找不到“Swiper”。我如何访问此 Swiper 类型并将其与我的 DOM 元素一起使用。

我尝试从 swiper 导入 Swiper Class,这似乎不是问题。当我将自定义对象设置为我导入的 Swiper 时,问题就开始了。它给我一个错误说 "export 'Swiper' was not found in 'swiper'"。我试过了:

// Importing the swiper class
import {Swiper} from 'swiper';

// creating the object
  const swipes = new Swiper('.swiper-container');

我只需要幻灯片像演示一样发挥作用。

您不需要将 swiper 安装到 Ionic4 中 - 它是内置的。

查找 ion-slides documentation,您将看到有关如何自定义它并在 Ionic 中使用它的大量代码示例。