用vue开发的详情页,路由参数变化,页面刷新问题

看到别人的解决方法,具体是否正确,有待考证

created () {
  console.log(this.getStatus(this.$route.path))
},
watch: {
   '$route' (to, from) {
     console.log(this.getStatus(this.$route.path))
   }
},
methods: {
    getStatus (urlStr) {
      var urlStrArr = urlStr.split('/')
      return urlStrArr[urlStrArr.length - 1]
    }
},

原文地址:https://www.cnblogs.com/auto123-num/p/7308107.html