added chat code as plugin for client rendering

This commit is contained in:
Markus 2023-07-04 21:42:14 +02:00
parent 932ad7037f
commit 708c769a3b
3 changed files with 33 additions and 29 deletions

View File

@ -127,6 +127,7 @@ export default {
{ src: '~/plugins/vue-infinite-loading.js', ssr: false }, { src: '~/plugins/vue-infinite-loading.js', ssr: false },
{ src: '~/plugins/vue-observe-visibility.js', ssr: false }, { src: '~/plugins/vue-observe-visibility.js', ssr: false },
{ src: '~/plugins/v-mapbox.js', mode: 'client' }, { src: '~/plugins/v-mapbox.js', mode: 'client' },
{ src: '~/plugins/vue-advanced-chat.js', mode: 'client' },
], ],
router: { router: {

View File

@ -1,34 +1,30 @@
<script setup>
import { register } from 'vue-advanced-chat'
register()
// import { register } from 'vue-advanced-chat/dist/vue-advanced-chat.es.js'
// window['vue-advanced-chat'].register()
</script>
<template> <template>
<div> <div>
<internal-page :pageParams="pageParams" /> <client-only>
<vue-advanced-chat <internal-page :pageParams="pageParams" />
:current-user-id="currentUserId" <vue-advanced-chat
:template-actions="JSON.stringify(templatesText)" :current-user-id="currentUserId"
:text-messages="JSON.stringify(textMessages)" :template-actions="JSON.stringify(templatesText)"
:menu-actions="JSON.stringify(menuActions)" :text-messages="JSON.stringify(textMessages)"
:rooms="JSON.stringify(rooms)" :menu-actions="JSON.stringify(menuActions)"
:messages="JSON.stringify(messages)" :rooms="JSON.stringify(rooms)"
:room-actions="JSON.stringify(roomActions)" :messages="JSON.stringify(messages)"
:rooms-loaded="true" :room-actions="JSON.stringify(roomActions)"
show-files="false" :rooms-loaded="true"
show-audio="false" show-files="false"
:show-footer="true" show-audio="false"
:messages-loaded="messagesLoaded" :show-footer="true"
@send-message="sendMessage($event.detail[0])" :messages-loaded="messagesLoaded"
@fetch-messages="fetchMessages($event.detail[0])" @send-message="sendMessage($event.detail[0])"
:theme="theme" @fetch-messages="fetchMessages($event.detail[0])"
:is-device="isDevice" :theme="theme"
@show-demo-options="showDemoOptions = $event" :is-device="isDevice"
/> @show-demo-options="showDemoOptions = $event"
<base-button @click="theme = theme === 'light' ? 'dark' : 'light'"> />
change style mode <base-button @click="theme = theme === 'light' ? 'dark' : 'light'">
</base-button> change style mode
</base-button>
</client-only>
</div> </div>
</template> </template>

View File

@ -0,0 +1,7 @@
import { register } from 'vue-advanced-chat'
export default ({ app }) => {
if(process.client){
register()
}
}