pass dynamic props to component vuejs code example
Example 1: vuejs send required props to dynamic component
<component :is="currentComponent" v-bind="currentProperties"></component>
Example 2: pass method as props vue
<Child-Component @alert="sayHi" />
methods: {
sayHi() {
alert('Hi')
}
}
<element @click="doSomething">
methods: {
doSomething() {
this.$emit('alert')
}
}
Example 3: vue passing props
<!-- Dynamically assign the value of a variable -->
<blog-post v-bind:title="post.title"></blog-post>
<!-- Dynamically assign the value of a complex expression -->
<blog-post
v-bind:title="post.title + ' by ' + post.author.name"
></blog-post>