Widget < TOptions > 泛型类

如果部件需要一些额外的初始化选项,可以从 Widget< TOptions > 类派生。

在类方法中可以通过受保护的字段 options 访问传递给构造函数的选项。

  1. public abstract class Widget< TOptions > : Widget
  2. where TOptions: class, new()
  3. {
  4. protected Widget(jQueryObject element, TOptions opt = null) { ... }
  5. protected readonly TOptions options;
  6. }