簡體   English   中英

值變化時輸入 Animation Angular 2+

[英]Input Animation when value changes Angular 2+

您好,我是 angular 動畫的新手,我想在輸入值更改時使我的輸入動畫(是一個計算器)。 我已經這樣做了,如何拍攝一個事件來執行animation?

@Component({
    selector: 'xxxxx',
    templateUrl: './yyyy.html',
    styleUrls: ['./example.scss'],
    animations: [
        trigger('simpleFadeAnimation', [
            state('in', style({opacity: 1})),
            transition(':enter', [
                style({opacity: 0}),
                animate(600)
            ])
        ])
    ]
})

你可以使用通配符

animations: [
        trigger('simpleFadeAnimation', [
            transition('*=>*', [
                style({opacity: 0}),
                animate(600)
            ])
        ])
    ]

所以,你可以使用

<div [@simpleFadeAnimation]="value">
.....some...
</div>

每次更改變量“值”時,animation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM