Skip to content

Vue component

  • One vue file that is responsible both for the template as for the instance. The so called component
  • Components can be reused all over the app. Components must be instanciated!
  • Vue file parts
  • template: html
  • script: js
  • style: css
  • Babel and Webpack convert the vue files into plain html, js and css files
<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" />
    <HelloWorld msg="Welcome to Your Vue.js App" />
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue';

export default {
  name: 'App',
  components: {
    HelloWorld
  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>