[Vuejs]-Vue2 + laravel6 – Component implementation

0πŸ‘

βœ…

In Vue world, there are two popular types of defining a component

First Type

in this type, you add all of your HTML inside the template property
and the props add as attribute inside the component object to

Vue.component('button-counter', {
  data: function () {
    return {
      count: 0
    }
  },
  template: '<button v-on:click="count++">You clicked me {{ count }} times.</button>'
})

Second Type

in this type you add your component logic in a separate file ends with .vue
for example in laravel there is an ExampleComponent.vue file you will find on
it just template tag just as a wrapper for your component content and your logic you can write it as it mentions below.

<template>
   // some content here
</template>

<script>
export default {
   props: [],
   methods: {
       
   },
   data(){
      return {
      }
   }
}
</script>

Finally

there is no tag called props or data

for more info read this article

Leave a comment