Complete the code to globally register a Vue component named 'MyButton'.
import { createApp } from 'vue'; import App from './App.vue'; import MyButton from './components/MyButton.vue'; const app = createApp(App); app.[1]('MyButton', MyButton); app.mount('#app');
In Vue 3, the component method on the app instance is used to globally register a component.
Complete the code to locally register the 'MyCard' component inside the components option.
<script setup> import MyCard from './MyCard.vue'; </script> <script> export default { components: { [1]: MyCard } } </script>
When locally registering components, the key in the components object is usually the component's PascalCase name.
Fix the error in the code by completing the blank to correctly register the component locally.
<script> import UserProfile from './UserProfile.vue'; export default { [1]: { UserProfile } } </script>
The correct option to locally register components in Vue is the components property.
Fill both blanks to complete the code that globally registers two components 'HeaderComp' and 'FooterComp'.
import { createApp } from 'vue'; import App from './App.vue'; import HeaderComp from './HeaderComp.vue'; import FooterComp from './FooterComp.vue'; const app = createApp(App); app.[1]('HeaderComp', HeaderComp); app.[2]('FooterComp', FooterComp); app.mount('#app');
Use the component method twice to globally register multiple components on the app instance.
Fill all three blanks to complete the code that locally registers 'NavBar', uses it in the template, and globally registers 'FooterBar'.
<template> <NavBar /> <FooterBar /> </template> <script> import NavBar from './NavBar.vue'; import FooterBar from './FooterBar.vue'; import { createApp } from 'vue'; import App from './App.vue'; const app = createApp(App); app.[1]('FooterBar', FooterBar); export default { [2]: { [3]: NavBar } }; app.mount('#app'); </script>
Globally register 'FooterBar' with component, locally register 'NavBar' inside the components option, and use the exact component name 'NavBar' as the key.