JavaScript framework.
Vue.js is a progressive JavaScript framework used for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. This unit will provide an introduction to Vue.js, its directives and components, the Vue.js instance and lifecycle, and how to build a simple application with Vue.js. We will also introduce Vue Router and Vuex.
Vue.js was created by Evan You, a former Google engineer, who used AngularJS in many projects and wanted to extract the parts he really liked about Angular into a lightweight and easy-to-use framework. Since its release in 2014, Vue.js has gained popularity due to its simplicity and performance.
Vue.js uses a template syntax that allows you to declaratively bind the rendered DOM to the underlying Vue instance’s data. All Vue.js templates are valid HTML that can be parsed by spec-compliant browsers and HTML parsers. Under the hood, Vue compiles the templates into Virtual DOM render functions.
Components are one of the most powerful features of Vue.js. They help you extend basic HTML elements to encapsulate reusable code. At a high level, components are custom elements that Vue’s compiler attaches behavior to.
Every Vue application starts by creating a new Vue instance with the Vue
function. A Vue application consists of a root Vue instance created with new Vue
, optionally organized into a tree of nested, reusable components.
Each Vue instance goes through a series of initialization steps when it’s created - for example, it needs to set up data observation, compile the template, mount the instance to the DOM, and update the DOM when data changes. Along the way, it also runs functions called lifecycle hooks, giving users the opportunity to add their own code at specific stages.
Building an application with Vue.js involves creating a new Vue instance and defining components, data, methods, and more. We will walk through the process of creating a simple Vue.js application, from setting up the development environment to deploying the application.
Vue Router is the official router for Vue.js. It deeply integrates with Vue.js core to make building Single Page Applications with Vue.js a breeze. Vuex is a state management pattern + library for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion.
By the end of this unit, you should have a basic understanding of Vue.js and be able to start building simple applications using this powerful framework.