Component properties


Just like Vue instances, Vue components have properties. As a matter of a fact, most of them are the same:

  • data
  • mixins
  • components
  • beforeCreate
  • created
  • beforeMount
  • mounted
  • beforeUpdate
  • updated
  • beforeDestroy
  • destroyed

You may just go ahead and treat components as Vue instances. There is one difference:

The data property is a function in Vue components and needs to return. 

This is how we initialize data in Vue instances:

data: {
title: 'some title',
count: 0

And this is how we do it in components: 

data() {
return [
title: 'some title',
count: 0

The rest of properties use the exact same syntax as Vue instances does.