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}]}});
表单项
在表单中使用
<ui.form><form.item cols="12" title="用户名" hint="用户名的用途"><check.group source={source} /></form.item></ui.form>
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}]}});
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 source={source} block />
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 name="全选" checked={checkedAll} on-check={this._checkAll($event)} /><check.group source={source} />
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