Yao b42d1e8e8f
[bugfix] 修复 gulp 插件引起的组件编译后代码异常的问题 (#209)
* add eslint

* eslint 校验

* reset gulp build config
2018-04-30 23:08:58 +08:00

29 lines
521 B
JavaScript

Component({
relations: {
'../btn/index': {
type: 'child',
linked() {
updateBtnChild.call(this);
},
linkChange() {
updateBtnChild.call(this);
},
unlinked() {
updateBtnChild.call(this);
}
}
}
});
function updateBtnChild() {
let btns = this.getRelationNodes('../btn/index');
if (btns.length > 0) {
let lastIndex = btns.length - 1;
btns.forEach((btn, index) => {
btn.switchLastButtonStatus(index === lastIndex);
});
}
}