
Learning a new framework can be a very complicated process for any developer, especially for someone that is still learning the basics of JavaScript. For this reason, we decided to create this series, which will make Vue.js learning as easy and digestible as possible.
How to integrate Vue.js to your project
There are several ways you can integrate Vue into your web project. Let's begin with the simplest one.
Most tutorials automatically assume that you understand how to set up and run a development environment in which you should use things like npm, the webpack...
We will start with a much simpler beginner-friendly approach.
Just go ahead and run your favorite code editor. Then, create a new file called index.html.
<html> <head> <title>Vue test page</title> </head> <body> <h1>Hi world!</h1> <div id="app"></div> </body> </html>
We just set the bones for a simple website, nothing really fancy. Now, let's get the library of Vue. Before closing,< /body >
paste this script tag.
[...] <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </body>
So we can use Vue now that it's loaded into our page. Let's go ahead and and and in a < script > tag create a new Vue instance. We will give it a selector by passing #app to the options object property, and Vue will know where to render our app.
Place this script after html.
<script> const app = new Vue({ el: '#app', // 1 data: { // 2 myLocalProperty: 'Im a local property value' // 3 } }); </script>
So what's going on here? We created a Vue instance and pass It a configuration object.
el
: As I said before, we have to tell Vue where we want our app to be displayed in our HTML. Div with the app ID in this cadata object
: Vue instance has a local storage system, such as a box of variables and properties that we can use when coding the app. Data holds a JavaScript object, so we assign it one with the { } syntax. Inside, we place a property.myLocalProperty
: This property is defined within the data object for our instance, the name is myLocalProperty and the value on the right is the value - a string in this case.
Displaying properties on our app
Right now, if you open index.html in your browser, there's not much going on.
Let's add some code:
<html> <head> <title>Vue 101</title> </head> <body> <h1>Hi world!</h1> <div id="app"> <p>My local property: {{ myLocalProperty }}</p> </div> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script> const app = new Vue({ el: '#app', data: { myLocalProperty: 'Im a local property value' } }); </script>
Be careful with this line:
<p>My local property: {{ myLocalProperty }}</p>
What's happening here is called variable interpolation, which is a fancy term for "I'm going to display the content of my myLocalProperty variable in this placeholder where my {{ }} are now.
Reload the page, and you will now see the string updates to reflect our variable.
Go ahead and try to change the string inside myLocalProperty to some other text and reload the page, you should see the text update accordingly.
Vue is a reactive framework
Let's discuss reactivity. You may have heard that Vue is a reactive framework. But what exactly does this mean? Open up your console in the chrome developer tools, and with your index.html loaded type:
app.myLocalProperty = 'Vue is reactive';
You will see the page react to this change!
Read Vue.js: a quick start guide for beginners. Part 2!

Janeth Kent
Licenciada en Bellas Artes y programadora por pasión. Cuando tengo un rato retoco fotos, edito vídeos y diseño cosas. El resto del tiempo escribo en MA-NO WEB DESIGN END DEVELOPMENT.
Related Posts
Node.js and npm: introductory tutorial
In this tutorial we will see how to install and use both Node.js and the npm package manager. In addition, we will also create a small sample application. If you…
How to connect to MySQL with Node.js
Let's see how you can connect to a MySQL database using Node.js, the popular JavaScript runtime environment. Before we start, it is important to note that you must have Node.js installed…
JavaScript Programming Styles: Best Practices
When programming with JavaScript there are certain conventions that you should apply, especially when working in a team environment. In fact, it is common to have meetings to discuss standards…
Difference between arrow and normal functions in JavaScript
In this tutorial we are going to see how arrow functions differ from normal JavaScript functions. We will also see when you should use one and when you should use…
JavaScript Arrow functions: What they are and how to use them
In this article we are going to see what they are and how to use JavaScript Arrow Functions, a new feature introduced with the ES6 standard (ECMAScript 6). What are Arrow…
How to insert an element into an array with JavaScript
In this brief tutorial you will learn how to insert one or more elements into an array with JavaScript. For this we will use the splice function. The splice function will not…
What is the difference between primitives types and objects in JavaScript?
In this short tutorial we are going to look at the differences between primitive types and objects in JavaScript. To start with, we're going to look at what primitive types…
How to get DOM elements with JavaScript
When you access any element of the DOM, it is usual to save it in a variable. This is something that at first might seem very simple, but if you…
How to reverse an array in JavaScript
In this tutorial we are going to see how you can change the order of the elements of an array so that they are inverted. You could use a loop…
How synchronize the scroll of two divs with JavaScript
In case you have two divs of different sizes you may sometimes want to scroll both at the same time but at different speeds depending on their size. For example,…
How to use the codePointAt method in JavaScript
The JavaScript codePointAt method has more or less the same function as the charCodeAt method, used to get the 16-bit Unicode representation of the character at a certain position in…
How to check if a value is a number in JavaScript
In this short tutorial we are going to look at the various methods that exist to find out if a value is a number in JavaScript. 1. Using the isNaN() function One…