How to create component in vue js cli?
In this post we will give you information about How to create component in vue js cli?. Hear we will give you detail about How to create component in vue js cli?And how to use it also give you demo for it if it is necessary.
You can learn how to create own component in vue npm. we will use vue cli to create vue js setup and then we will create own custom component in vue js. you can simply create vue cli component with laravel or codeigniter app.
We will learn from scratch to create vue component. so first we will create vue js project using vue cli. then we will create Exmaple.vue component and import Example component in app. So let’s see bellow steps:
Create Vue Project
vue create my-vue-library
Create Vue Component
src/components/Example.vue
<template>
<div >
<div >
<div >
<div >
<div >My Example</div>
<div >
Welcome to ItSolutionStuff.com
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
mounted() {
console.log('Component mounted.')
}
}
</script>
Update App.vue
src/App.vue
<template>
<div id="app">
<Example></Example>
</div>
</template>
<script>
import Example from './components/Example.vue'
export default {
name: 'app',
components: {
Example
}
}
</script>
I hope it can help you…
Hope this code and post will helped you for implement How to create component in vue js cli?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs