v3.0.6
This commit is contained in:
56
source/wx/xzs-student/component/iView/tabs/index.js
Normal file
56
source/wx/xzs-student/component/iView/tabs/index.js
Normal file
@@ -0,0 +1,56 @@
|
||||
Component({
|
||||
externalClasses: ['i-class'],
|
||||
|
||||
relations: {
|
||||
'../tab/index': {
|
||||
type: 'child',
|
||||
linked () {
|
||||
this.changeCurrent();
|
||||
},
|
||||
linkChanged () {
|
||||
this.changeCurrent();
|
||||
},
|
||||
unlinked () {
|
||||
this.changeCurrent();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
properties: {
|
||||
current: {
|
||||
type: String,
|
||||
value: '',
|
||||
observer: 'changeCurrent'
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
scroll: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
fixed: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeCurrent (val = this.data.current) {
|
||||
let items = this.getRelationNodes('../tab/index');
|
||||
const len = items.length;
|
||||
|
||||
if (len > 0) {
|
||||
items.forEach(item => {
|
||||
item.changeScroll(this.data.scroll);
|
||||
item.changeCurrent(item.data.key === val);
|
||||
item.changeCurrentColor(this.data.color);
|
||||
});
|
||||
}
|
||||
},
|
||||
emitEvent (key) {
|
||||
this.triggerEvent('change', { key });
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user