-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.vue
71 lines (60 loc) · 1.21 KB
/
app.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<script setup lang="ts">
import { useDatabase } from '~/composables/useDatabase'
import type { RxTodoDocument } from '~/types'
// Use your database here
const database = await useDatabase()
// State management
const todoList = ref<RxTodoDocument[]>([])
database.todos
.find({
sort: [{ state: 'desc' }, { lastChange: 'desc' }]
})
.$.subscribe((todos: RxTodoDocument[]) => {
todoList.value = todos
})
</script>
<template>
<GitHubBanner />
<section class="todoapp">
<header class="header">
<h1>TodoMVC with RxDB & P2P</h1>
<AppDescription />
<hr />
<NewTodoItem />
</header>
<section class="main">
<TodoList :todo-list="todoList" />
</section>
</section>
<TheFooter />
</template>
<style>
@import 'todomvc-app-css/index.css';
.todoapp h1 {
top: -80px;
font-size: 40px;
}
.description {
padding: 15px;
margin-bottom: 10px;
}
code {
display: block;
padding: 15px;
/**
* https://css-tricks.com/better-line-breaks-for-long-urls/
*/
overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-word;
hyphens: auto;
}
a {
color: #b83f45;
font-weight: bold;
text-decoration: none;
}
a:visited {
color: #b83f45;
}
</style>