Follow these steps to add your component to your Vue application:
- Open the App.vue file in the src folder.
- In the components property, asynchronously import the RandomCat.vue component:
<script>
export default {
name: 'App',
components: {
RandomCat: () => import('./components/RandomCat'),
},
};
</script>
- In the <template> section of the file, declare the imported component:
<template>
<div id="app">
<random-cat />
</div>
</template>
To run the server and see your component, you need to open Terminal (macOS or Linux) or Command Prompt/PowerShell (Windows) and execute the following command:
> npm run serve
Here is your component rendered and running: