这是一个答案,不是问题,但我不知道如何在这里发布答案 .

在看到some articles后,我才知道 -
ionContent指令提供了一个易于使用的内容区域,可以配置为使用Ionic的自定义Scroll View .

在我的情况下,想要滚动 <ion-contain> 内的特定部门,例如 -

<ion-content>
       <div>
            <div>
              <p> Scroll should not be apply </p>
           </div>
       </div>

    <div *ngFor="let item in items">
             <div>
              <p> Scroll **should be apply** </p>  
                {{item}}
           </div>
    </div>
</ion-content>
  • 我开始了解VirtualScroll,但它正在滚动整页,这与我的要求不符 .

  • 还来看了Scroll property of ionic,这不符合我的要求 .

然后我来看看在离子论坛下列出的一篇很棒的文章,并帮助了我很多,因为https://forum.ionicframework.com/t/ionic-2-scrollable-div-within-ion-content/58788

<ion-content style="overflow-y: hidden;">
    <div>
        <h1>This stuff should not scroll.</h1>
    </div>

    <ion-scroll scrollY="true" style="width: 100%; height: 100%;">
    <div *ngFor="let boy in boys">
            <h3>This stuff should scroll.</h3>
    </div>
    </ion-scroll>
</ion-content>

Here was the required above code.这对我很有帮助 . 非常感谢这篇文章的作者(asrinivasan) .

Note:- I came to notice - If we have ion-item tag in our code, it could cause some issue for us. So make sure to remove this tag.