[Vuejs]-Get data attributes from v-link

2👍

Assuming you have a post object inside your component that you set with ajax after the route is loaded

data: function() {
  return {
    post: {}
  }
}

and

route: function() {
  data: function() {
    var resource = fetchPost(this.$route.params.slug)
    this.$set('post', resource)
  }
}

You can access the post.id everywhere in your component like this this.$data.post.id
The v-postid directive is not required for that.

Leave a comment