<b id="wionh"></b>

<u id="wionh"><address id="wionh"><meter id="wionh"></meter></address></u>

watch監聽路由變化詳解

時間:2021-09-14 11:20:17 類型:vue
字號:    

  一、watch監聽路由的方法

  通過watch監聽,當路由發生變化的時候執行。

  方法一:

watch:{
  $router(to,from){
       console.log(to.path)
  }
}

  方法二:

watch: {
   $route: {
     handler:  function (val, oldVal){
       console.log(val);
     },
     // 深度觀察監聽
     deep:  true
   }
},

  方法三:

  watch: {
  '$route' : 'getPath'
  },
  methods: {
  getPath(){
  console.log( this .$route.path);
  }
  }


中文无码妇乱子二区三区_久久亚洲精品无码福利播放_毛片一级_日韩aⅴ无码久久精品免费

<b id="wionh"></b>

<u id="wionh"><address id="wionh"><meter id="wionh"></meter></address></u>

<