Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Vue.js 2

You're reading from   Learning Vue.js 2 Learn how to build amazing reactive web applications easily with Vue.js

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher Packt
ISBN-13 9781786469946
Length 334 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Olga Filipova Olga Filipova
Author Profile Icon Olga Filipova
Olga Filipova
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Going Shopping with Vue.js 2. Fundamentals – Installing and Using FREE CHAPTER 3. Components – Understanding and Using 4. Reactivity – Binding Data to Your Application 5. Vuex – Managing State in Your Application 6. Plugins – Building Your House with Your Own Bricks 7. Testing – Time to Test What We Have Done So Far! 8. Deploying – Time to Go Live! 9. What Is Next? A. Solutions to Exercises

Single-file components


We know from the old best practices that it is always good to separate HTML from CSS and JavaScript files. Some modern frameworks such as React are relaxing and gradually wiping out this rule. Nowadays, you will not be shocked by looking at the small file or the component that contains its own markup, style, and application code inside it. Actually, for small components, we even find it more convenient to have such architecture. Vue also allows defining everything related to the same component in the same file. This kind of component is known as a single-file component.

Note

A single-file Vue component is a file with a .vue extension. The application that contains such components can be built using the webpack vue configuration. To scaffold an app with such a configuration, the easiest way is to use vue-cli ( https://github.com/vuejs-templates/webpack).

A Vue component can have up to three sections in it:

  • <script>
  • <template>
  • <style>

Each of these sections...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime