加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular 2动画“无法在’Element’上执行’animate’:不支持部

发布时间:2020-12-17 10:24:31 所属栏目:安全 来源:网络整理
导读:我创建了以下Angular 2动画: trigger('detailsContentAnimation',[ state('1',style( { 'height': '*','padding-top': '*','padding-bottom': '*' })),state('0',style( { 'height': 0,'padding-top': 0,'padding-bottom': 0 })),transition('* = *',animat
我创建了以下Angular 2动画:
trigger('detailsContentAnimation',[
    state('1',style(
      {
        'height': '*','padding-top': '*','padding-bottom': '*'
      })),state('0',style(
      {
        'height': 0,'padding-top': 0,'padding-bottom': 0
      })),transition('* => *',animate('400ms ease-out'))
  ])

此动画应滑入/滑出以下HTML内容:

<div>
 <div class="col-card__content-div">
  <div [@detailsContentAnimation]="areDetailsVisible" class="card-block">
    <ng-content select=".col-card__contentselector--body"></ng-content>
  </div>
</div>

当动画发生时,我收到以下错误:

Failed to execute ‘animate’ on ‘Element’: Partial keyframes are not supported.”

为什么会发生这种情况,我该如何解决?

基于提供的代码,这似乎对我有用(在Chrome 59.0.3,Firefox 54.0.1和Safari 9中测试,全部在Mac上).
请参阅此 minimal example on Github,即 running live here.以下是使用您的代码的 card component和 card template的直接链接.我尝试但无法重现您的错误.

我的版本:

"@angular/animations": "^4.3.1","@angular/common": "^4.0.0","@angular/compiler": "^4.0.0","@angular/core": "^4.0.0","@angular/forms": "^4.0.0","@angular/http": "^4.0.0","@angular/platform-browser": "^4.0.0","@angular/platform-browser-dynamic": "^4.0.0","@angular/router": "^4.0.0"

我建议尝试:

>如果需要,请更新动画库
>将您的代码与我的示例进行比较以发现差异
>发布更多代码,项目或minimal,complete,verifiable example,以便我可以帮助您进一步调试:)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读