Skip to content

TypeError: this._routerRoot is undefined #432

Closed
@kerolloz

Description

@kerolloz

example github repository: https://github.com/kerolloz/vue-class-component-bug

[Vue warn]: Error in data(): "TypeError: this._routerRoot is undefined"

<template>
  <div>
    <h1>{{ title }}</h1>
    <p>Path: {{ currentPath }}</p>
  </div>
</template>

<script lang="ts">
import Vue from "vue";
import Component from "vue-class-component";

@Component
export default class HelloWorld extends Vue {
  // data() {
  //   return {
  //     title: "Bug",
  //     currentPath: this.$route.path,
  //   };
  // }
  title = "Bug";
  currentPath = this.$route.path;
}
</script>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions