Created
October 3, 2018 06:21
-
-
Save WietseWind/484fe6a2c0fa37e40ceae117cfe19489 to your computer and use it in GitHub Desktop.
Components in Vue2 (in the src/ folder)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
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 /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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