Nuxt/examples/composables/use-state/app.vue

20 lines
508 B
Vue
Raw Permalink Normal View History

<script setup>
const counter = useState('counter', () => Math.round(Math.random() * 1000))
2022-05-20 09:25:38 +00:00
const sameCounter = useState('counter')
</script>
<template>
<NuxtExampleLayout example="composables/use-state">
<div>Counter: {{ counter }}</div>
<div>Same Counter: {{ sameCounter }}</div>
<div>
<NButton class="font-mono" @click="counter++">
+
</NButton>
<NButton class="font-mono" @click="counter--">
-
</NButton>
</div>
</NuxtExampleLayout>
</template>