Monaca Onsen UI Discord Chat Github Repo

How to navigator back to the tabbar page in onsen ui with VUE?



  • I test this demo https://github.com/OnsenUI/vue-onsenui-kitchensink

    When i navigator to page A, then to page B, the to page C, then I wan’t navigator to the root tabbar page, but it got error :

    “Uncaught (in promise) ons-navigator’s page stack is empty.”

    this code from store.js

    navigator: {
      strict: true,
      namespaced: true,
      state: {
        stack: [],
        options: {}
      },
      mutations: {
        push(state, page) {
          state.stack.push(page);
        },
        pop(state) {
          if (state.stack.length > 1) {
            state.stack.pop();
          }
        },
        replace(state, page) {
          state.stack.pop();
          state.stack.push(page);
        },
        reset(state, page) {
          state.stack = [page || state.stack[0]];
        },
        options(state, newOptions = {}) {
          state.options = newOptions;
        }
      }
    },
    

    When i call the reset function, it got that error. Thank you very much!