You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
542 B
Vue
33 lines
542 B
Vue
<template>
|
|
<div>
|
|
{{ id }}
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { nanoid } from 'nanoid'
|
|
import { ref } from '@nuxtjs/composition-api'
|
|
import { tryOnMounted, useLocalStorage } from '@vueuse/core'
|
|
import connectWebsocket from '~/composables/connectWebsocket'
|
|
|
|
export default {
|
|
name: 'IndexPage',
|
|
setup() {
|
|
const { data, send, open } = connectWebsocket()
|
|
const id = ref(null)
|
|
|
|
tryOnMounted(() => {
|
|
open()
|
|
id.value = useLocalStorage('ooc_user_id', nanoid())
|
|
})
|
|
|
|
return {
|
|
send,
|
|
data,
|
|
open,
|
|
id,
|
|
}
|
|
},
|
|
}
|
|
</script>
|