Understand Single-File Components (SFCs) in vue-loader
mainvue-loader allows you to author Vue components using the Single-File Component (SFC) format, which encapsulates <template>, <script>, and <style> in a single .vue file.
Key features include:
- Using different webpack loaders for different blocks (e.g., Sass for
<style>, Pug for<template>). - Support for custom blocks with custom loader chains.
- Treating static assets in
<style>and<template>as module dependencies. - Scoped CSS simulation.
- State-preserving hot-reloading.
<template>
<div class="example">{{ msg }}</div>
</template>
<script>
export default {
data() {
return {
msg: 'Hello world!',
}
},
}
</script>
<style>
.example {
color: red;
}
</style>