【问题标题】:ionic3 BrowserAnimationModule离子 3 浏览器动画模块
【发布时间】:2018-10-21 04:41:27
【问题描述】:

我尝试在我的项目中导入 BrowserAnimaionModule

1- 我安装 npm install web-animations-js @angular/animations@4.0.0 --save

2- 我在 main.ts 中导入 polyfill

导入'web-animations-js/web-animations.min';

3- 当我尝试将 app.module.ts 中的 BrowserAnimationModule 添加到 imports[]

这是登录表单的js代码

 import { Component, trigger, state, style, transition, animate, keyframes } from '@angular/core';
  ;
     
    @Component({
      selector: 'page-login',
      templateUrl: 'login-page.html',
     
      animations: [
     
        //For the logo
        trigger('flyInBottomSlow', [
          state('in', style({
            transform: 'translate3d(0,0,0)'
          })),
          transition('void => *', [
            style({transform: 'translate3d(0,2000px,0'}),
            animate('2000ms ease-in-out')
          ])
        ]),
     
        //For the background detail
        trigger('flyInBottomFast', [
          state('in', style({
            transform: 'translate3d(0,0,0)'
          })),
          transition('void => *', [
            style({transform: 'translate3d(0,2000px,0)'}),
            animate('1000ms ease-in-out')
          ])
        ]),
     
        //For the login form
        trigger('bounceInBottom', [
          state('in', style({
            transform: 'translate3d(0,0,0)'
          })),
          transition('void => *', [
            animate('2000ms 200ms ease-in', keyframes([
              style({transform: 'translate3d(0,2000px,0)', offset: 0}),
              style({transform: 'translate3d(0,-20px,0)', offset: 0.9}),
              style({transform: 'translate3d(0,0,0)', offset: 1}) 
            ]))
          ])
        ]),
     
            })
        
    }

我收到了这个错误 对象原型只能是 Object 或 null:未定义

【问题讨论】:

  • 你在哪里使用这个? html``and .ts 代码?
  • 我不明白你的问题你能解释更多吗?
  • 你能显示你的实现的code吗?
  • 好的,我现在就分享它

标签: animation ionic3


【解决方案1】:

您正在从错误的库中导入触发器、状态、样式、过渡、动画、关键帧。

import { trigger, state, style, animate, transition, keyframes } from '@angular/animations';  // not @angular/core

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-27
    • 1970-01-01
    • 2016-09-04
    相关资源
    最近更新 更多