v3.0.6
This commit is contained in:
38
source/wx/xzs-student/component/iView/radio-group/index.js
Normal file
38
source/wx/xzs-student/component/iView/radio-group/index.js
Normal file
@@ -0,0 +1,38 @@
|
||||
Component({
|
||||
externalClasses: ['i-class'],
|
||||
relations: {
|
||||
'../radio/index': {
|
||||
type: 'child',
|
||||
linked() {
|
||||
this.changeCurrent();
|
||||
},
|
||||
linkChanged() {
|
||||
this.changeCurrent();
|
||||
},
|
||||
unlinked() {
|
||||
this.changeCurrent();
|
||||
}
|
||||
}
|
||||
},
|
||||
properties: {
|
||||
current: {
|
||||
type: String,
|
||||
value: '',
|
||||
observer: 'changeCurrent'
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
changeCurrent(val = this.data.current) {
|
||||
let items = this.getRelationNodes('../radio/index');
|
||||
const len = items.length;
|
||||
if (len > 0) {
|
||||
items.forEach(item => {
|
||||
item.changeCurrent(val === item.data.value);
|
||||
});
|
||||
}
|
||||
},
|
||||
emitEvent(current) {
|
||||
this.triggerEvent('change', current);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents":
|
||||
{
|
||||
"i-cell-group": "../cell-group/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<i-cell-group class="i-class">
|
||||
<slot></slot>
|
||||
</i-cell-group>
|
||||
Reference in New Issue
Block a user