Vue.js component structure
Components are the basis of the Vue.js framework. They are the building blocks required to create an application using this framework. As was previously explained, a component can be as small as a simple button or as large as a full page.
No matter their size, all components are built using the same syntax and structure. In this section, we are going to learn the different forms of syntax available to write components and learn about the different sections that make up a Vue.js single-file component (SFC).
Single-file components
SFCs are specific to Vue.js and can be found in Vue.js projects with the extension .vue
. These files are composed of three main sections: template, script, and style:
<template></template> <script></script> <style></style>
The Vue.js compiler takes the preceding three sections and splits them up into individual chunks during build time. We are now going to explain each of them in...