Nuxt/examples/use-state/app.vue

16 lines
277 B
Vue
Raw Normal View History

<script setup>
const counter = useState('counter', () => Math.round(Math.random() * 1000))
</script>
2021-10-11 17:48:03 +00:00
<template>
<div>
Counter: {{ counter }}
<button @click="counter++">
+
</button>
<button @click="counter--">
-
</button>
2021-10-11 17:48:03 +00:00
</div>
</template>