Skip to content

work with Server Side Render #174

Closed
Closed
@Penggggg

Description

@Penggggg

happened

when using @component with vue-server-renderer,the ssr code cannot find my custom static method in my custom component which is decorated by @component

version

  • vue: 2.5.2
  • vue-class-component: 6.0.0
  • vue-server-renderer: 2.5.2
  • vue-router: 3.0.1
  • typescript: 2.5.3
  • node: 7.6.0

detail

i want to run my custom static method in my custom component when the vue-router match this component in NodeJS witch is decorated by @component . But when the router has find this component, i can not find my static method in it.

code

Modal.component.ts

@Component({})
export default class Modal extends Vue {
  static asyncData( ) {
     // ... some code
  }
}

entry-server.ts

// main code
const matchedComponents = router.getMatchedComponents( );
matchedComponents.map(( Component: any ) => {
   console.log(  Component.asyncData );
  // it can find Modal Component, but the static method asyncData is undefined here
})

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