2017-07-16 54 views
0

我想實現這樣的:離子2:圓進度條而持有

當用戶點擊並按住元素,圓形進度條會顯示周圍的點壓。假設它必須持續2秒才能填滿圓,然後觸發一個事件。如果用戶早於2秒釋放,則不會發生任何事情。

+0

是這裏面'* ngFor'?在按鈕上按?提供一些代碼。 –

+0

分享你到目前爲止,它的早先幫助 – Huiting

回答

1

很難說沒有任何代碼的情況下你想要達到什麼目的,但離子有確實可以使用gestures

有明確要求pressed一個能像這樣

<ion-card (pressed)="pressedEvent($event)"> 
    <ion-item> 

    </ion-item> 
</ion-card> 

使用可能會觸發pressedEvent。在你的組件中,你可以從觸發的事件中獲得一些信息,或者也可以傳入要使用的信息。所以,如果它是在一個

*ngFor="let items of items;let idx=index" (pressed)="pressedEvent($event,item,idx)" 

,然後在組件

pressedEvent(ev,item,idx){ 
    // details on press event 
    console.log(ev); 
    // details on current item in loop being pressed 
    console.log(item); 
    // index of current item being pressed for specific array based manipulation 
    console.log(idx); 
}