How to use the selectItem method using Vue?
jujogi opened this issue · 3 comments
jujogi commented
How would be the correct way to use this method?
May be have an example?
Thanks!
fabioaraujo121 commented
Bind the on loaded listner on your component.
<BottomBar row="1" v-on:loaded="barLoaded">
<BottomBarItem icon="~/assets/images/icons/ic_home_filled.png" title="Home"
>
</BottomBar>
And at your method just use the event.object
.
barLoaded: function(event){
const bar = event.object;
bar.selectItem(bar.menuItemIndex);
}
Hope it help!
jujogi commented
Hi @fabioaraujo121, thanks for answering!
I'm trying to change selected BottomBar Item when I change the active page using the SideDrawer.
I'm tryed using Event Bus to comunicate both components but I don't know how to use selectItem in this case.
Any ideas?
Change page method in my SideDrawer
changePage() {
EventBus.$emit('bottom-bar-item', 1);
this.closeDrawer();
},
Receiving event in my BottomBar component
EventBus.$on("bottom-bar-item", barItem => {
this.selectItem(0); //error
this.barLoaded(barItem); //error
console.dir(barItem); //return 1
});
Thanks for help!
Regards,