widget-dev-demo 组件的具体代码请参考widget, 主要代码如下:

    1. // 获取组件所在的 html 容器
    2. const $container = this.getContainer();
    3. // 通过配置器里保存的数据源Id加载数据
    4. this.getSourceData(profile.dataSourceId, (data) => {
    5. // 将 数据源数据(data.rows) 和 配置数据(profile.oneLine) 塞给 tpl 模版进行渲染
    6. $container.html(tpl({
    7. locale: locale(),
    8. data: data.rows,
    9. oneLine: profile.oneLine
    10. }));
    11. // 通知平台 组件已经初始化完成
    12. this.trig('complete');
    13. });
    由于现在官方组件主要是基于 jquery ui 来开发的, 所以您开发的组件应尽量向 jquery ui 靠, 以保证页面上的组件保持一致。参考 使用和定制 Enhancer 内置样式jquery ui 颜色变量