Question 16
Read the Vue.js code and answer the given subquestions. The parent binds an input with v-model and passes the value as a prop to a child component; the child contains a named slot that shows the message in uppercase.
<div id="app"> <p>{{ message }}</p> <input v-model="message" /> <child-component :title="message"> <template slot="header"> <h3>{{ message.toUpperCase() }}</h3> </template> </child-component></div>
<script>Vue.component('child-component', { props: ['title'], template: ` <div> <h2>{{ title }}</h2> <slot name="header"></slot> <p>Child Content</p> </div> `});
new Vue({ el: '#app', data: { message: 'Hello Vue' }});</script>