Answers for "vue 3 create component"

2

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>
Posted by: Guest on July-13-2021
0

vue create component

// Create Vue application
const app = Vue.createApp(...)

// Define a new component called todo-item
app.component('todo-item', {
  template: `<li>This is a todo</li>`
})

// Mount Vue application
app.mount(...)
Posted by: Guest on July-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language