Skip to content

Instantly share code, notes, and snippets.

@ashx3s
Last active November 13, 2021 22:49
Show Gist options
  • Select an option

  • Save ashx3s/7b28e3dfdb0e075e97706f08c8e4ce39 to your computer and use it in GitHub Desktop.

Select an option

Save ashx3s/7b28e3dfdb0e075e97706f08c8e4ce39 to your computer and use it in GitHub Desktop.
Vue Component Structure

Vue Component Structure

  • In a vue component, you write your content into the template, add css to the styles, and declare your data, props, methods, etc into the script tag. You will also import other files into the script tag
  • Your vue components should be capitalized. components/Header.vue
  • but your layouts should be lowercase layouts/default.vue
  • This is an example of how a vue file is set up
<template>

<!-- HTML, compononents, vue directives here -->

</template>

<style>

/* This is optional */

</style>

<script>

// import modules etc here
export default ({
  el: '#app',
  props: {
    property: type
    // You can use arrays and objects here
  },
  data: {
  }
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment