Basics
Vue is a frontend JavaScript framework to build dynamic single pages app. React is the most used, especially in US and large tech companies. Vue is strong in Asia and among startups and fast-moving teams. Angular is dominant in corporate/enterprise environments. It has been adopted by Laravel as its default library for client-side apps.Components
A Vue app is made from independent and reusable components. There are three main separate area: template, script, style.Reactive
Vue is reactive and declarative, DOM automatically updates when items changes. Component logic is cleanly separated from the HTML.
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<div id="app">
<h1><span class='keyword_code'> message </span></h1>
<button @click='changeMessage'>Click me</button>
</div>
<script>
const { createApp } = Vue;
createApp({
data() {
return {
'message': 'Hello Vue!'
}
},
methods: {
changeMessage() {
this.message = 'Vue is awesome!';
}
}
}).mount('#app');
</script>
<style>
button {color: blue;}
</style>
Last update: Today