If you know HTML and JavaScript and are looking to take your knowledge to the next level by learning how to use a framework, this book is for you. and most of the code examples are pretty readable anyway.
If youre experienced with React, this book is , which explains some Vue.js concepts as compared to what you already know from React.
Book Layout
This book contains seven chapters and two appendixes:
The first chapter introduces the basics of Vue.js, the main technology that this book is about. I explain how to install it and introduce it into a web page, and how you can use it to display data on a page.
Vue.js allowsand encouragesyou to split your code into components that you can then reuse around your codebase. This chapter explains exactly how you can do that to create a more maintainable and understandable codebase.
Every other section of the book deals with HTML and JavaScript, but this chapter presents the more visual side of creating websites. I explain how Vue works with CSS and styles in order to style your websites and applications, and the helper functionality it has built in to assist you with this.
In addition to the templating syntax that youll recognize if youve seen much Vue code or read the Getting Started guide, Vue supports custom render functions, which also allow you to use JSX, a syntax youre familiar with if youve used React before. I explain how to use JSX in your Vue application in this chapter.
Vue by itself is just a view layer. To create an application with multiple pages that can be accessed without making a new request (or in buzzword format: a single-page application), you need to add vue-router to your website, which you can use to handle the routingsaying which code should be executed and displayed when a given path is requested. This chapter explains how to do just that.
In more complicated applications with many levels of components, passing data between components can become a bit of a pain. Vuex enables you to handle your applications state in one centralized place, and in this chapter I explain how you can use it to easily handle complicated application state.
By this point, youll have learned everything you need to know to get your website running, but if you want to maintain your site in the future, youll need to write tests for it. This chapter covers how to use vue-test-utils to write unit tests for your Vue components to ensure that they dont break in the future.
vue-cli enables you to quickly bootstrap Vue applications from given templates. This short appendix shows you how it works and presents a few of the templates.
If youve used React before, youre probably familiar with a lot of the concepts of Vue. This appendix highlights some of the differences, and some of the similarities, between Vue and React.
Style Guide
The examples throughout this book follow the guidelines outlined in the official Vue Style Guide. Once you understand Vue and are looking to work on a larger app or collaborate with other people, I definitely recommend reading the style guide and following the guidelines.
You can find the style guide on the Vue.js website.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This element signifies a tip or suggestion.
Note
This element signifies a general note.
Warning
This element indicates a warning or caution.
OReilly Safari
Note
Safari (formerly Safari Books Online) is a membership-based training and reference platform for enterprise, government, educators, and individuals.
Members have access to thousands of books, training videos, Learning Paths, interactive tutorials, and curated playlists from over 250 publishers, including OReilly Media, Harvard Business Review, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Adobe, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, and Course Technology, among others.