Skip to content

beforeRouteEnter does not working #2368

@rover5056

Description

@rover5056

Version

3.0.1

Reproduction link

https://codepen.io/ROVER_K/project/editor/ZrMzOx

Steps to reproduce

  1. install @vue/cli v3.0.1

2.vue create pro with vue-router, ts,scss,babel

3.just add these simple code in default About.vue file

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';

@Component
export default class About extends Vue {
  // here I try to fire this function automatic when come in this component 
  beforeRouteEnter (to, from, next) {
    console.log('tssssss223')
    next();
  }
}
</script>

What is expected?

I create a new project with vue-router by vue-cli v3 . And I 'm try beforeRouteEnter function and I found it does not fired. I just add simple codes on default project... So I am sure it's not other reason.. So is that any wrong with my code or my way to use it?

What is actually happening?

The beforeRouteEnter does not fired,either beforeRouteEnter.


Am I use this function wrong?
I just follow the guide and I have no idea about
My first aim is pass the params between the components.But I found this problem,so I create a new default project with VUE-CLI 3, and reproduce this problem again .

Thanks for your reading,wating for your reply~~
Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions