-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathexample.html
58 lines (49 loc) · 1.43 KB
/
example.html
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
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<title>Private chat example</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/@gun-vue/components/dist/style.css">
<script type="importmap">
{
"imports": {
"vue": "https://unpkg.com/vue@3.2.31/dist/vue.esm-browser.js",
"@gun-vue/components": "https://unpkg.com/@gun-vue/components@0.21.5",
}
}
</script>
<script type="module">
import { createApp } from 'https://esm.sh/vue'
import { GunVuePlugin } from 'https://unpkg.com/@gun-vue/components@0.21.5'
const app = createApp({
data() {
return {
other: ''
}
}
})
app.use(GunVuePlugin)
app.mount('#app')
</script>
</head>
<body>
<div id="app" class="flex-col gap-2">
<h1 class="text-2xl p-2">Private chat example Gun-Vue app</h1>
<div class="flex flex-wrap items-center gap-2 p-4">
<gun-relay></gun-relay>
<user-icon></user-icon>
<room-button></room-button>
</div>
<keep-alive max="5">
<template v-if="!other">
<guest-list @user="other=$event"></guest-list>
<guest-list @user="other=$event" state="offline"></guest-list>
</template>
<chat-private v-else :pub="other">
<button class="button" @click="other=''">Close</button>
</chat-private>
</keep-alive>
</div>
</body>
</html>