Last active
June 28, 2023 06:11
-
-
Save trandaison/9b8941d0860fd35d7b23a830cd7e5b40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts" setup> | |
import { useAsyncCookie } from '~/composables/useAsyncCookie'; | |
const expires = new Date(); | |
expires.setSeconds(5); | |
const testCookie = useAsyncCookie('test', { maxAge: 5 }); | |
testCookie.value = 'sometext'; | |
const c = useCookie('xxtest', { maxAge: 5 }); | |
c.value = '10000'; | |
const lazyVal = ref(''); | |
onMounted(() => { | |
setTimeout(() => { | |
console.log('>> timeout'); | |
lazyVal.value = testCookie.value; | |
}, 7000); | |
}); | |
</script> | |
<template> | |
<div> | |
<strong>Original value: </strong> {{ testCookie }} <br /> | |
<strong>Value after expired: </strong> {{ lazyVal }} | |
</div> | |
</template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment