Tuesday, 6 June 2017

[Vue warn]: Missing required prop: "Records"

I've got a vue component which declares a required property like this:

navbar.ts

@Component({
  template: require('./navbar.template.pug')
})
export class NavbarComponent extends Vue {
  @Prop({
    required: true
  })
  public Records: string[] = [];
}

The property should be provided by the AppComponent, which looks like this:

@Component({
  template: require('./app.template.pug'),
  components: {
    'app-navbar': NavbarComponent,
  }
})
export class AppComponent extends Vue {
  get Records(): RouteRecord[] {
    return this.$route.matched;
  }
}

When I fire up the application, I can see that the property has been correctly registered in the virtual DOM in the list of computed properties:

<Root>
  <Anonymous Component> == $vm0
    data:
      $route: Object
    computed:
      Records: Array[1]

Though vue still yells [Vue warn]: Missing required prop: "Records". Am I missing something here?



via null null

No comments:

Post a Comment