Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue同组件不同路由切换 #20

Open
Wscats opened this issue Nov 1, 2018 · 0 comments
Open

vue同组件不同路由切换 #20

Wscats opened this issue Nov 1, 2018 · 0 comments

Comments

@Wscats
Copy link
Owner

Wscats commented Nov 1, 2018

当我们使用路由的时候,切换不同路由进去同一个组件的时候,想监听这个路由的改变可以运用以下代码
kapture 2018-11-01 at 12 57 20

export default {
  data() {
//...
watch: {
    $route: function(to, from) {
      this.$route.params;
      console.log("路由变化了");
    }
  }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant