Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Created October 3, 2018 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WietseWind/484fe6a2c0fa37e40ceae117cfe19489 to your computer and use it in GitHub Desktop.
Save WietseWind/484fe6a2c0fa37e40ceae117cfe19489 to your computer and use it in GitHub Desktop.
Components in Vue2 (in the src/ folder)
<!--
Modify the <script> ... contents with:
(import Component Var Name from ./filename without .vue)
-->
import MyComponent from './MyComponent'
<!-- ... and the beginning of your Vue object: -->
export default {
components: {
MyComponent
},
<!-- Now use your component in your Template: -->
<MyComponent />
<template>
<div>
This is my {{ name }}
</div>
</template>
<script>
export default {
name: 'MyComponent',
data () {
return {
name: 'Sample Component'
}
},
methods: {
},
mounted () {
}
}
</script>
<style scoped>
div { font-size: 1em; font-weight: bold; color: red; }
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment