angular 动画 query用法
query API 翻译 function query(selector: string,animation: AnimationMetadata | AnimationMetadata[],options: AnimationQueryOptions | null = null): AnimationQueryMetadata;
描述query是一个动画特效function被用于angular的动画DSL领域语言 用法query()通过 element.querySelectorAll 来收集多个元素和工作。 query('div',[
animate(...),animate(...)
],{ limit: 1 })
query(),by default,will throw an error when zero items are found. If a query has the optional flag set to true then this error will be ignored. query('.some-element-that-may-not-be-there',{ optional: true })
特殊选择器这种语法可以帮助筛选出特殊的元素 query(':self,.record:enter,.record:leave,@subTrigger',[...])
实例@Component({ selector: 'inner',template: ` <div [@queryAnimation]="exp"> <h1>Title</h1> <div class="content"> Blah blah blah </div> </div> `,animations: [ trigger('queryAnimation',[ transition('* => goAnimate',[ // hide the inner elements query('h1',style({ opacity: 0 })),query('.content',// animate the inner elements in,one by one query('h1',animate(1000,style({ opacity: 1 })),]) ]) ] }) class Cmp { exp = ''; goAnimate() { this.exp = 'goAnimate'; } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |