2017-06-18 73 views
2

如何導航到Framework7中的路線& VueJs app。如何導航到Framework7 + Vue應用程序中的路線?

我想顯示一個slpash屏幕並在兩秒後導航到下一頁。代碼粘貼在下面。

<template> 
... 
</template> 

<script> 
    export default { 
     name: "splash", 
     mounted: function() { 
      this.$router.load({url: '/about/'}); // error 
     }, 
     data: function() { 
      return { 
       msg : "hello" 
      } 
     } 
    } 
</script> 

注:這是應用程序組件(Main.vue)。

+0

試試這個。$ router.replace('/ about')' –

+0

@VamsiKrishna $ router是未定義的。 –

+0

請參閱最後一節**路由器API **此處(http://framework7.io/vue/navigation-router.html),這可能是問題 –

回答

6

終於這對我有效。

this.$f7.mainView.router.load({url: "/user-settings"}) 

從文檔

請注意,$路徑和$路由器組件屬性只是你根據路線加載自定義頁面組件(及其子組件)內可用。在父組件中(比如在View中,或者你啓動你的Vue應用程序實例的地方),它們是不可訪問的,因爲你的應用程序每次可能只有很少的路由器(視圖)。因此,在這種情況下,使用對初始化的視圖實例的訪問,例如$ f7.views.main.router或$ f7.mainView.router

相關問題