Answers for "import vue component from js file"

7

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>
Posted by: Guest on December-21-2020
8

vue import component

// With Vue 3.2 
<script setup>
import Btn from './components/Btn'
</script>

<template>
  <Btn />
</template>
Posted by: Guest on November-02-2020

Browse Popular Code Answers by Language