gpt4 book ai didi

angular - 使用主机绑定(bind)设置 Angular 动画参数

转载 作者:行者123 更新时间:2023-12-03 18:37:42 24 4
gpt4 key购买 nike

我一直在尝试使用 @HostBinding 设置动画参数装饰性的,但似乎不起作用,我错过了什么

animations: [
trigger('animateMe', [
state('void', style({ opacity: 0 })),
transition(':enter, :leave', [ // void <=> *
animate('{{ easeTime}}ms {{ transitionTimingFn }}')
])
])
]

和主机绑定(bind)
@HostBinding('@animateMe') state = {
value: 'void',
params: {
easeTime: 5000
}
};

最佳答案

如果将 getter 函数添加到主机绑定(bind)属性,则可以设置动画参数。

trigger: any;
easingTime = 5000;

@HostBinding('@animateMe')
get fn() {
return {
value: this.trigger,
params: {
easeTime: this.easingTime
}
}
};

关于angular - 使用主机绑定(bind)设置 Angular 动画参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49725827/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com