Monaca Onsen UI Discord Chat Github Repo

How to change tabbar in page components ?

  • this is my code

          <div class="center">{{title}}</div>
        <v-ons-tabbar position="auto">
          <template slot="pages">
              <component :is="page"></component>
          <v-ons-tab v-for="(pageItem,pageIndex) in pageList"
                     :active="page === pageItem.pageComponents"

    and I want to change tabbar in page components,How to do this?

  • Onsen UI

    @丶JavaScript Do you mean changing the current page from a button inside pages? You’ll need to pass a prop function to modify your page variable or emit an event to do it.

  • @Fran-Diox Do u mean add a prop function in ons-tabbar to change current page?

  • Onsen UI

    @丶JavaScript said:

    <component :is=“page” :set-page="() => showPage(…)"></component>

    <component :is=“page” @page=“showPage(…)”></component>

    You pass props or event handler to the page components so you can communicate with them.