generated from kuba1pie/vueTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTheArchive.vue
49 lines (44 loc) · 1.04 KB
/
TheArchive.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<script setup lang="ts">
import type { Message } from '../types'
const store = useDefaultStore()
function getLocalStorage() {
let archiveData: Message[] = []
if (window.localStorage.getItem('archiveData') !== '') {
try {
archiveData = JSON.parse(localStorage.getItem('archiveData')!) as Message[]
store.setArchive(archiveData)
}
catch (e) {
}
}
else {
archiveData = []
}
}
getLocalStorage()
</script>
<template>
<div class="c-theArchive flex flex-col w-200">
<h2>Message history</h2>
<div v-if="store.archiveMessages">
<MessageContent
v-for="item in store.archiveMessages"
:key="item"
:message-data="item"
/>
</div>
<div
v-else
class="error text-red-800/90 flex flex-col"
>
No send messages yet
<button
type="submit"
class="c-tabButton bg-grey-500/20 px-8 py-3 text-8 w-80 m-0 my-10 border-0"
@click="store.activeTab = 'TheEditor'"
>
Go to Editor
</button>
</div>
</div>
</template>