我一直在摆弄Angular动画,并想知道是否有最佳/推荐的方法来避免内联样式...例如,
@Component({
selector: 'page-that-needs-anime',
templateUrl: './anime.component.html',
styleUrls: ['./anime.component.scss'],
animations: [
trigger('animeTrigger', [
state('in', style({transform: 'translateY(0)'})),
transition('void => *', [
animate(700, keyframes([
style({opacity: 0, transform: 'translateY(-100%)', offset: 0}),
style({opacity: 1, transform: 'translateY(25px)', offset: 0.3}),
style({opacity: 1, transform: 'translateY(0)', offset: 1.0})
]))
]) //you get the idea ... *Import statement is taken out for brevity
Run Code Online (Sandbox Code Playgroud)
无论如何,"动画"可以使用类似styleUrls&templateUrl的引用吗?我见过有人把它称为const但是想知道是否有'Angular官方'方式.
对于那些使用mobx+编写应用程序的人react,我想知道在带有&的 react 组件中使用事件处理程序时是否有更好的方法来处理上下文问题(例如,在商店中this.返回)。undefinedmobxonClickinjectobserver
我一直在写处理程序onClick={actionFromStore.bind(this.props.theStore)}来解决这个问题,但似乎应该有更简洁的方法来做到这一点,我不知道。
我不是 mobx 专家,任何建议将不胜感激!
这里的操作是异步获取请求