While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.
Vue.js is quickly becoming a very popular option as a library for reactive components. It’s lightweight, simple to grasp and fun to play with, and it can prove to be a great alternative to other libraries like React or Angular.
Let’s get our feet wet with the simplest of examples. Here’s the code for our basic Hello World app, with the interesting parts highlighted:
<!DOCTYPE html>
<html lang="en">
<meta>
<meta charset="UTF-8">
<title>Hello World in Vue.js</title>
</meta>
<body>
<div id="hello-world-app">
<h1>{{ msg }}</h1>
</div>
<script
src="//cdnjs.cloudflare.com/ajax/libs/vue/2.1.6/vue.min.js">
</script>
<script>
new Vue({
el: "#hello-world-app",
data() {
return {
msg: "Hello World!"
}
}
});
</script>
</body>
</html>
Step by step breakdown:
And that’s it for this brief introduction! Learn more by reading the getting started section of the official Vue.js guide.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.
Sign upClick below to sign up and get $100 of credit to try our products over 60 days!