@mac
In Vue.js, props are used to pass data from a parent component to a child component. Here are the steps to pass props in Vue.js:
1 2 3 |
props: { message: String } |
1
|
<child-component message="Hello Vue.js"></child-component> |
1 2 3 |
<template> <div>{{ message }}</div> </template> |
That's it! The child component will receive the prop value from the parent component and display it accordingly. You can pass multiple props in the same way by specifying them in the props option of the child component and passing them as attributes from the parent component.