1. var component = new NEKUI.Component({
    template: template,
    data: {
    source: [
    {name: '选项1', id: 1},
    {name: '选项2', id: 2},
    {name: '选项3', id: 3},
    {name: '选项4', id: 4},
    {name: '选项5', id: 5},
    {name: '选项6', id: 6}
    ]
    }
    });

表单项

在表单中使用

复选组 check.group - 图2

  1. <ui.form>
    <form.item cols="12" title="用户名" hint="用户名的用途">
    <check.group source={source} />
    </form.item>
    </ui.form>
  1. var component = new NEKUI.Component({
    template: template,
    data: {
    source: [
    {name: '选项1', id: 1},
    {name: '选项2', id: 2},
    {name: '选项3', id: 3},
    {name: '选项4', id: 4},
    {name: '选项5', id: 5},
    {name: '选项6', id: 6}
    ]
    }
    });

  1. var component = new NEKUI.Component({
    template: template,
    data: {
    source: [
    {name: '选项1', id: 1},
    {name: '选项2', id: 2},
    {name: '选项3', id: 3},
    {name: '选项4', id: 4},
    {name: '选项5', id: 5},
    {name: '选项6', id: 6}
    ]
    }
    });

多行

复选组 check.group - 图4

  1. <check.group source={source} block />

    1. var component = new NEKUI.Component({
      template: template,
      service: {
      getList: function(params, success) {
      NEKUI.ajax.request({
      url: '../data/list.json',
      method: 'get',
      type: 'json',
      data: params,
      success: success
      });
      }
      }
      });

    全选

    复选组 check.group - 图6

    1. <check name="全选" checked={checkedAll} on-check={this._checkAll($event)} />
      <check.group source={source} />
    1. var component = new NEKUI.Component({
      template: template,
      data: {
      source: [
      {name: '选项1', id: 1},
      {name: '选项2', id: 2},
      {name: '选项3', id: 3},
      {name: '选项4', id: 4},
      {name: '选项5', id: 5},
      {name: '选项6', id: 6}
      ]
      },
      computed: {
      checkedAll: function() {
      var source = this.data.source;
      return source.filter(function(item) {
      return item.checked;
      }).length === source.length;
      }
      },
      _checkAll: function(event) {
      this.data.source.forEach(function(d) {
      d.checked = !!event.checked;
      })
      },
      });

    API

    Functions

    Kind: global classExtend: CheckGroup

    config()