import TopBtn from '../top_btn/TopBtn' const {ccclass, property} = cc._decorator; @ccclass export default class TopMenu extends cc.Component { // @property({ type: cc.Node }) // snode: cc.Node = null @property({type: cc.Node}) container: cc.Node = null @property({type: [TopBtn]}) btns: TopBtn[] = [] start () { // this.initBtns() this.btns[0].setSelect(true) cc.zevent.on('top_btn_change', (index: number) => { for (let i = 0, l = this.btns.length; i < l; i++) { if (index !== i) { this.btns[i].setSelect(false) } } }) } }