Ionic 5 Ion-Slider 绑定选项不影响组件

Ionic 5 Ion-Slider Bound Options Not Affecting the Component

我正在使用 Ionic 5 并想自定义 ion-slides 绑定 options,但是绑定到组件的对象文字不会更改 UI 中的任何内容。

我使用 vanilla Swiper 创建了一个示例 Stackblitz so the options not working is replicated. You can see that even adding initialSlide doesn't seem to work, which is the example from their docs - Ionic Slides. I tried a bunch of Swiper parameters as well with no luck. In a separate Stackblitz 我可以看到应该发生什么。

我确定这可能是我做错的小事。谁能看出为什么选项没有生效?

而不是:

public slideOptions : {
  initialSlide: 2, 
  slidesPerView: 2,
  centeredSlides: true,
  spaceBetween: 30,
};

你想要:

public slideOptions = {
  initialSlide: 2, 
  slidesPerView: 2,
  centeredSlides: true,
  spaceBetween: 30,
};

我在 typescriptlang.org 测试了上面两个示例的转译,当前代码仅转译为 slideOptions; 而不是您想要的对象。