Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

vue 3 create component

//-------------------- This is your main vue file
<template>
<h1>Your File Name Title</h1>
<p>Random text</p>
// now import your component here --- see below comments to find the component code
<ComponentName />
</template>
<script>
  import ComponentName from '/componentlocation'
export default{
name: 'MainFile',
components: {
	ComponentName
}}
</script>

//------------ This is the component code in a different file

<template>
<h1>This is the component</h1>
</template>

<script>
export default{
name: 'ComponentName'
}
</script>
 
PREVIOUS NEXT
Tagged: #vue #create #component
ADD COMMENT
Topic
Name
5+7 =