![]() ![]() Now if we load our page, we can see that our AccountInfo component properly renders the value passed in by its parent.Īs when working with other VueJS directives, we can use v-bind to dynamically pass props. Then, to actually pass the data from the parent ( ProfilePage.vue), we pass it like a custom attribute. So, inside the component options, let’s make it look like the following. Inside AccountInfo.vue, we can declare the props it accepts using the props option. The parent component passing the prop, let’s call this ProfilePage.vue.The child component accepting the prop, let’s call this AccountInfo.vue. ![]() Then, in our template, we can give those attributes values and - BAM - we’re passing data from a parent to a child component!įor example, let’s say we’re working on a user profile page and want to have a child component accept a username prop. Props are custom attributes that we can give to a component. VueJS props are the simplest way to share data between components. Using Props To Share Data From Parent To Child ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |