2023-05-26 19:42:12 +00:00
|
|
|
<script setup>
|
|
|
|
useCookie('accessed-but-not-used')
|
|
|
|
useCookie('accessed-with-default-value', () => 'default')
|
|
|
|
useCookie('set').value = 'set'
|
|
|
|
useCookie('set-to-null').value = null
|
|
|
|
useCookie('set-to-null-with-default', () => 'default').value = null
|
|
|
|
// the next set are all sent by browser
|
|
|
|
useCookie('browser-accessed-but-not-used')
|
|
|
|
useCookie('browser-accessed-with-default-value', () => 'default')
|
|
|
|
useCookie('browser-set').value = 'set'
|
|
|
|
useCookie('browser-set-to-null').value = null
|
|
|
|
useCookie('browser-set-to-null-with-default', () => 'default').value = null
|
2024-01-02 15:37:19 +00:00
|
|
|
|
|
|
|
const objectCookie = useCookie('browser-object-default', {
|
|
|
|
default: () => ({ foo: 'bar' })
|
|
|
|
})
|
2023-05-26 19:42:12 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div>cookies testing page</div>
|
2024-01-02 15:37:19 +00:00
|
|
|
<pre>{{ objectCookie }}</pre>
|
|
|
|
<button @click="objectCookie.foo = 'baz'">
|
|
|
|
Change cookie
|
|
|
|
</button>
|
2023-05-26 19:42:12 +00:00
|
|
|
</div>
|
|
|
|
</template>
|