我通过npm下载了GSAP包,现在我想通过TypeScript将TweenLite类导入到我的应用程序中。这可以通过编写require('gsap');
导入所有GSAP来完成,并且效果很好。但在TypeScript中它不起作用。 我想这样做:import TweenLite from 'gsap';
。TweenLite typescipt import
可能吗?
我通过npm下载了GSAP包,现在我想通过TypeScript将TweenLite类导入到我的应用程序中。这可以通过编写require('gsap');
导入所有GSAP来完成,并且效果很好。但在TypeScript中它不起作用。 我想这样做:import TweenLite from 'gsap';
。TweenLite typescipt import
可能吗?
npm install --save-dev gsap
npm install --save-dev @types/gsap
在你的TS文件,导入GSAP
import {TweenLite} from "gsap";
,并在你的方法,你可以写
let photo = document.getElementById("photo");
TweenLite.to(photo, 2, {width:"200px", height:"550px"});
,如果你有照片
与一个div和ID
当我这样做会出现错误“名称空间中的导入声明无法引用模块”。如果我将导入移出模块,则会出现模块内部的许多错误 –