n Passing Data to Child Components with Props in Vuejs | CodimTh

Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

Props are custom attributes you can register on a component. When a value is passed to a prop attribute, it becomes a property on that component instance.

Examples How to pass a title and a body to our blog post component:

<blog-post title="My journey with Vue" body="lorem ipsum"></blog-post>

<blog-post :title="title" :body="body"></blog-post>

 

Examples How to include these props in the list of props this component accepts, using a props option:

Vue.component('blog-post',

{

props: ['title','body'],

template: '<h3>{{ title }}</h3><p>{{ body }}</p>'

})

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook