1. Home
  2. /
  3. Nuxt-js
  4. /
  5. Nuxt.js Counter with v-model binding

Nuxt.js Counter with v-model binding - Nuxt-js Typing CST Test

Loading…

Nuxt.js Counter with v-model binding — Nuxt-js Code

Uses v-model for two-way binding of count prop.

<template>
  <div :class="isDark ? 'dark-theme' : 'light-theme'">
    <h2>Counter: {{ count }}</h2>
    <input type="number" v-model.number="count" />
    <button @click="count++">+</button>
    <button @click="count--">-</button>
    <button @click="count=0">Reset</button>
    <button @click="isDark = !isDark">Switch Theme</button>
  </div>
</template>

<script setup>
import { ref } from 'vue';
const count = ref(0);
const isDark = ref(false);
</script>

<style>
.dark-theme { background-color: #222; color: #eee; }
.light-theme { background-color: #fff; color: #000; }
</style>

Nuxt-js Language Guide

Nuxt.js is a high-level framework built on top of Vue.js for creating modern web applications with SSR, SSG, API integration, routing, performance optimizations, and full-stack capabilities using server routes. It emphasizes flexibility, DX, and hybrid rendering.

Primary Use Cases

  • ▸SEO-focused websites
  • ▸Static or hybrid-rendered sites
  • ▸Full-stack Vue apps with API routes
  • ▸E-commerce and SaaS dashboards
  • ▸Enterprise Vue applications

Notable Features

  • ▸File-based routing
  • ▸Vue Server Components (Nuxt Islands)
  • ▸Universal rendering (SSR/SSG)
  • ▸Nitro server engine + API routes
  • ▸Auto-imports + module ecosystem

Origin & Creator

Created by the Chopin brothers (Alexandre & Sébastien Chopin) and released in 2016, maintained by the NuxtLabs team.

Industrial Note

Nuxt excels in SEO-heavy websites, fast content sites, dashboards, PWAs, internationalized apps, and full-stack Vue-based platforms.

More Nuxt-js Typing Exercises

Nuxt.js Counter with refNuxt.js Counter with localStorageNuxt.js Counter using computedNuxt.js Counter with composableNuxt.js Counter with propsNuxt.js Counter with watchEffectNuxt.js Counter with CSS variablesNuxt.js Counter with historyNuxt.js Counter with buttons map

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher