Skip to content

Commit

Permalink
radio.group增加value的配置
Browse files Browse the repository at this point in the history
  • Loading branch information
ZianeCui committed Feb 17, 2017
1 parent f4f2c58 commit 71b39e4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/js/components/form/radio.group/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,20 @@ var RadioGroup = SourceComponent.extend({
selected: null,
_radioGroupId: new Date(),
required: false,
nameKey: 'name'
nameKey: 'name',
key: 'id',
value: ''
});
this.supr();

// this.$on('select', function(event){
// var data = this.data;
// var key = data.key;
// var selected = event.selected;
// var value = selected[key];
// data.value = value === undefined? selected['name'] : value;
// })

var $outer = this.$outer;
if($outer && $outer instanceof Validation) {
$outer.controls.push(this);
Expand All @@ -65,7 +75,12 @@ var RadioGroup = SourceComponent.extend({
if(this.data.readonly || this.data.disabled)
return;

this.data.selected = item;
var data = this.data;
var key = data.key;
var value = item[key];
data.value = value === undefined ? item[nameKey] : value;

data.selected = item;
/**
* @event select 选择某一项时触发
* @property {object} sender 事件发送对象
Expand Down

0 comments on commit 71b39e4

Please sign in to comment.