typescript怎么導入jquery?
使用 typescript 寫 jQuery 插件
/// <reference path="jquery/jquery.d.ts" />
export class Carousel {
constructor(
public element: JQuery,
options?: CarouselOptions
) {
this.options = $.extend({}, CarouselDefaultOptions, options)
}
public options: CarouselOptions;
}
export interface CarouselOptions {
range?: number,
itemTag?: string,
boxTag?: string,
animationTime?: any,
animationMode?: string
}
/**
* 默認設置
*/
class CarouselDefaultOptions implements CarouselOptions {
itemTag: string = 'li';
boxTag: string = '.box';
animationTime: any = '1s';
animationMode: string = 'slow';
}