仅对离子选择触发的变化做出反应

时间:2019-09-16 19:03:45

标签: ionic-framework ionic4

我有这个离子选择成分:

<ion-select
          id="soundTypeSelect"
          #soundTypeSelect
          class="octave-select"
          [ngModel]="soundConfig.soundType"
          okText="OK"
          cancelText="{{ 'CANCEL' | translate }}"
          (ionChange)="newSoundType($event)"
          interface="popover"
        >
 <ion-select-option [value]="soundType" id="soundType-{soundType}">
              {{ soundType | translate }}
            </ion-select-option>
</ion-select

它可以正常工作。显示选项以及用户更改时的调用中的newSoundType()函数。

soundConfig来自全局服务,现在我有了用例,其中不仅在此组件中而且在另一个组件中更改了该值。

我遇到的问题是,当该值在其他组件中更改时,此选择也会对更改做出反应,并调用newSoundType()。有没有办法对这个组件说“嘿,您必须对直接与您进行的更改做出反应”?

我尝试使用ionFocusionBlur来设置标志,但是由于在onChange触发之前它进入blur状态,所以它不能正常工作:

enter image description here

我现在正在做的是在1000毫秒内将模糊标志设置为超时,但感觉不对...

0 个答案:

没有答案