mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
24 lines
439 B
Vue
24 lines
439 B
Vue
<template>
|
|
<div>
|
|
<h1> Counter: {{ counter || '-' }}</h1>
|
|
<button @click="counter = null">
|
|
reset
|
|
</button>
|
|
<button @click="counter--">
|
|
-
|
|
</button>
|
|
<button @click="counter++">
|
|
+
|
|
</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
const counter = useCookie('counter')
|
|
counter.value = counter.value || Math.round(Math.random() * 1000)
|
|
</script>
|
|
|
|
<style scoped>
|
|
button { margin: 10px 5px; }
|
|
</style>
|