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.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Alligator.io is a developer-focused resource that offers tutorials and insights on a wide range of modern front-end technologies, including Angular 2+, Vue.js, React, TypeScript, Ionic, and JavaScript.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.