vuejs import code example

Example 1: vuejs import component

<template>
  <your-component></your-component>
</template>

<script>
  import YourComponent from '../components/YourComponent.vue'
  
  export default {
	components: {
      YourComponent // <=> YourComponent: 'YourComponent'
    }	
  };
</script>

<!-- OR -->

<script>
  export default {
	components: {
      YourComponent: () => import('your/component/path')
    }
  }
</script>

Example 2: vue import component

<template>
  <Btn />
</template>

<script>
import Btn from './components/Btn'

export default {
  components: { Btn },
}
</script>

Example 3: vue js app component

// main.js
import { createApp } from 'vue'
import App from './App.vue'
import 'YourComponent' from 'YourFileOrLibrary';


const app = createApp(App);
app.component('yourComponent', YourFileOrLibrary);

// ...

Example 4: import vue js

<script src="https://unpkg.com/vue"></script>

Example 5: import vue

import Vue from 'vue'

Tags:

Misc Example