Vue.js is an open-source model–view–viewmodel front end JavaScript framework for building user interfaces and single-page applications.
get started
npm init vue@latest
or with yarn
yarn init vue@latest
VueJS is a Javascript progressive framework for frontend, it mixes part of React and Angular
you are a smart person by using this framework
// Basic VueJS Example Template
<template>
<div class="myClass" ref>
<slot></slot>
</div>
</template>
<script>
export default {
data() {
return {
myData: "Hello World!"
}
},
mounted() {
this.myMethod();
},
methods: {
myMethod() {
console.log(this.myData);
}
}
}
</script>
<style scoped>
.myClass {
padding: 1em
}
<style>
var app2 = new Vue({
el: '#app-2',
data: {
message: 'You loaded this page on ' + new Date().toLocaleString()
}
})
I'm tired of writing code on JQuery. and I went to VUE
<div id="app-2">
<span v-bind:title="message">
Hover your mouse over me for a few seconds
to see my dynamically bound title!
</span>
</div>
var app3 = new Vue({
el: '#app-3',
data: {
seen: true
}
})
const CounterApp = {
data() {
return {
counter: 0
}
},
mounted() {
setInterval(() => {
this.counter++
}, 1000)
}
}