Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Demonstrates a simple counter component using Vue.js reactive data and methods.
<template>
<div :class="{ 'dark-theme': isDark, 'light-theme': !isDark }">
<h2>Counter: {{ count }}</h2>
<div>
<button @click="increment">+</button>
<button @click="decrement">-</button>
<button @click="reset">Reset</button>
</div>
<button @click="toggleTheme">Switch to {{ isDark ? 'Light' : 'Dark' }} Theme</button>
</div>
</template>
<script>
export default {
data() {
return { count: 0, isDark: false };
},
methods: {
increment() { this.count++; },
decrement() { this.count--; },
reset() { this.count = 0; },
toggleTheme() { this.isDark = !this.isDark; }
}
};
</script>
<style>
.dark-theme { background-color: #222; color: #eee; }
.light-theme { background-color: #fff; color: #000; }
</style>Vue.js is a progressive, open-source JavaScript framework for building user interfaces and single-page applications. It emphasizes simplicity, declarative rendering, and reactive data binding.
Origin & Creator
Created in 2014 by Evan You, a former Google engineer, inspired by Angular but with a simpler core.
Industrial Note
Vue.js is specialized for building modern front-end web applications and integrating into existing projects incrementally.