Nuxt/examples/use-state/app.vue

16 lines
314 B
Vue
Raw Normal View History

2021-10-11 17:48:03 +00:00
<template>
<div>
Locale: {{ locale }}
<button @click="updateLocale">
Set to Klington
</button>
</div>
</template>
<script setup>
// Defined in composables/stats.ts
// same as useState('locale')
const locale = useLocale()
2021-10-11 17:48:03 +00:00
const updateLocale = () => { locale.value = 'tlh-klingon' }
</script>