<tfoot id='2WebG'></tfoot>
<legend id='2WebG'><style id='2WebG'><dir id='2WebG'><q id='2WebG'></q></dir></style></legend>
<i id='2WebG'><tr id='2WebG'><dt id='2WebG'><q id='2WebG'><span id='2WebG'><b id='2WebG'><form id='2WebG'><ins id='2WebG'></ins><ul id='2WebG'></ul><sub id='2WebG'></sub></form><legend id='2WebG'></legend><bdo id='2WebG'><pre id='2WebG'><center id='2WebG'></center></pre></bdo></b><th id='2WebG'></th></span></q></dt></tr></i><div id='2WebG'><tfoot id='2WebG'></tfoot><dl id='2WebG'><fieldset id='2WebG'></fieldset></dl></div>
      <bdo id='2WebG'></bdo><ul id='2WebG'></ul>
    1. <small id='2WebG'></small><noframes id='2WebG'>

        Anime.js 在 Ionic 3 项目中不起作用

        时间:2023-09-09

          <legend id='Zdumn'><style id='Zdumn'><dir id='Zdumn'><q id='Zdumn'></q></dir></style></legend>
          <tfoot id='Zdumn'></tfoot>

              <small id='Zdumn'></small><noframes id='Zdumn'>

                <bdo id='Zdumn'></bdo><ul id='Zdumn'></ul>

                    <tbody id='Zdumn'></tbody>
                  <i id='Zdumn'><tr id='Zdumn'><dt id='Zdumn'><q id='Zdumn'><span id='Zdumn'><b id='Zdumn'><form id='Zdumn'><ins id='Zdumn'></ins><ul id='Zdumn'></ul><sub id='Zdumn'></sub></form><legend id='Zdumn'></legend><bdo id='Zdumn'><pre id='Zdumn'><center id='Zdumn'></center></pre></bdo></b><th id='Zdumn'></th></span></q></dt></tr></i><div id='Zdumn'><tfoot id='Zdumn'></tfoot><dl id='Zdumn'><fieldset id='Zdumn'></fieldset></dl></div>
                • 本文介绍了Anime.js 在 Ionic 3 项目中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我尝试在我的 Ionic 3 项目中使用anime.js,但每当我在.ts 文件中使用函数anime({}) 时,它都会报告错误.

                  I am trying to use anime.js i my Ionic 3 project but whenever I use the function anime({}) in the .ts file it reports an error.

                  Error: Uncaught (in promise): TypeError: __webpack_require__.i(...) is not a 
                  function
                  TypeError: __webpack_require__.i(...) is not a function
                  at new AnimationPage (http://localhost:8100/build/main.js:56040:78)
                  at createClass (http://localhost:8100/build/main.js:11137:26)
                  at createDirectiveInstance (http://localhost:8100/build/main.js:10973:37)
                  at createViewNodes (http://localhost:8100/build/main.js:12323:49)
                  at createRootView (http://localhost:8100/build/main.js:12228:5)
                  at callWithDebugContext (http://localhost:8100/build/main.js:13359:42)
                  at Object.debugCreateRootView [as createRootView] 
                  (http://localhost:8100/build/main.js:12820:12)
                  at ComponentFactory_.create (http://localhost:8100/build/main.js:10164:46)
                  at ComponentFactoryBoundToModule.create 
                  (http://localhost:8100/build/main.js:3779:29)
                  at NavControllerBase._viewInit 
                  (http://localhost:8100/build/main.js:43786:44)
                  at c (http://localhost:8100/build/polyfills.js:3:12642)
                  at Object.reject (http://localhost:8100/build/polyfills.js:3:11998)
                  at NavControllerBase._fireError 
                  (http://localhost:8100/build/main.js:43544:16)
                  at NavControllerBase._failed (http://localhost:8100/build/main.js:43532:14)
                  at http://localhost:8100/build/main.js:43587:59
                  at t.invoke (http://localhost:8100/build/polyfills.js:3:8488)
                  at Object.onInvoke (http://localhost:8100/build/main.js:4477:37)
                  at t.invoke (http://localhost:8100/build/polyfills.js:3:8428)
                  at r.run (http://localhost:8100/build/polyfills.js:3:3686)
                  at http://localhost:8100/build/polyfills.js:3:13183
                  Ionic Framework: 3.2.1
                  Ionic App Scripts: 1.3.7
                  Angular Core: 4.1.0
                  Angular Compiler CLI: 4.1.0
                  Node: 7.4.0
                  OS Platform: Windows 10
                  Navigator Platform: Win32
                  User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 
                  (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
                  

                  我的文件 animation.ts 是:

                  my file animation.ts is :

                  import { Component } from '@angular/core';
                  import { IonicPage, NavController, NavParams } from 'ionic-angular';
                  import { trigger,state,style,transition,animate,keyframes } from '@angular/animations';
                  import { anime } from 'animejs';
                  /**
                   * Generated class for the AnimationPage page.
                   *
                   * See http://ionicframework.com/docs/components/#navigation for more info
                   * on Ionic pages and navigation.
                   */
                  @IonicPage()
                  @Component({
                    selector: 'page-animation',
                    templateUrl: 'animation.html',
                  
                  })
                  export class AnimationPage {
                      state: string ="small";
                    constructor( public navCtrl: NavController, public navParams: NavParams) {
                        anime({
                          targets: '.animatable',
                          translateX: 250
                        });
                  
                    }
                  
                  
                    animateThis(){
                      this.state=(this.state=='small'?'large':'small');
                    }
                  
                  
                  
                  
                  
                  
                    ionViewDidLoad() {
                      console.log('ionViewDidLoad AnimationPage');
                    }
                  
                  }
                  

                  如果还有其他需要整理的文件,请询问!

                  If there is any other file you need to sort this out please ask!

                  推荐答案

                  我也遇到了这个问题,并通过检查DefinitelyTyped(链接).

                  I also had this problem, and fixed it by examining the tsconfig.json next to the typings in DefinitelyTyped (link).

                  我在本地 tsconfig 中缺少的是 "allowSyntheticDefaultImports": true.添加后,我可以以与 DefinitelyTyped 测试,它使用:

                  What I was missing in my local tsconfig was "allowSyntheticDefaultImports": true. With that added, I could import in the same way as the DefinitelyTyped test, which uses:

                  从animejs"导入动漫;

                  然后它可以添加如下动画(具有预期的类型支持):

                  It then works to add animations like the following (with the expected type support):

                  anime({ targets: "#my-div", opacity: 0.5, duration: 1000 });

                  这篇关于Anime.js 在 Ionic 3 项目中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Ionic 3 - 使用异步数据更新 Observable 下一篇:在 Angular 2/Typescript 中使用 IScroll

                  相关文章

                  最新文章

                    <bdo id='wprwO'></bdo><ul id='wprwO'></ul>
                • <small id='wprwO'></small><noframes id='wprwO'>

                  <legend id='wprwO'><style id='wprwO'><dir id='wprwO'><q id='wprwO'></q></dir></style></legend>

                  <i id='wprwO'><tr id='wprwO'><dt id='wprwO'><q id='wprwO'><span id='wprwO'><b id='wprwO'><form id='wprwO'><ins id='wprwO'></ins><ul id='wprwO'></ul><sub id='wprwO'></sub></form><legend id='wprwO'></legend><bdo id='wprwO'><pre id='wprwO'><center id='wprwO'></center></pre></bdo></b><th id='wprwO'></th></span></q></dt></tr></i><div id='wprwO'><tfoot id='wprwO'></tfoot><dl id='wprwO'><fieldset id='wprwO'></fieldset></dl></div>

                    <tfoot id='wprwO'></tfoot>