Skip to content

beforeRouteEnter not called on first load when defined in global mixin for single file component  #1395

@zsalzbank

Description

@zsalzbank

Version

2.5.3

Reproduction link

https://github.com/zsalzbank/vue-router-before-route-enter-mixin-single-file-component

Steps to reproduce

  1. Load the minimal reproduction in the browser and open the developer console.
  2. Notice that there is no message with bre or bre next. (There will be one with be.)
  3. Click the World link.
  4. Notice that there is no message with bre or bre next. (There will be one with be.)
  5. Click the Hello link.
  6. Notice that the console logged bre and bre next. (There will be one with be too.)
  7. Click the World link.
  8. Notice that the console logged bre and bre next. (There will be one with be too.)

What is expected?

The bre and bre next messages are shown when the page loads initially. They should also be shown when navigating to the World link for the first time.

What is actually happening?

The messages are not shown.


This does work when the component is not a single file component. An example of this can be found here: http://jsfiddle.net/wq4kftpa/5/

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