-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.vue
67 lines (60 loc) · 1.9 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
<template>
<main class="container">
<button @click="ask">Push me</button>
</main>
<footer class="container-fluid">
<small>
<a href="https://github.com/Djaler/vue-promise-dialogs/blob/master/packages/demo/src/App.vue"
class="secondary"
target="_blank"
>
Source code
</a>
</small>
</footer>
<PromiseDialogsWrapper/>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { openConfirmDialog } from './confirm-dialog';
import { PromiseDialogsWrapper } from 'vue-promise-dialogs';
import { openNotifyDialog } from './notify-dialog';
export default defineComponent({
name: 'App',
components: { PromiseDialogsWrapper },
methods: {
async ask() {
const userLikesLibrary = await openConfirmDialog({
text: "Do you like vue-promise-dialogs?"
});
if (!userLikesLibrary) {
await openNotifyDialog({
text: "That's sad. Feel free to create issue on github"
});
return;
}
const userWantsToPutStar = await openConfirmDialog({
text: "Can I ask you to star this project on github?",
confirmButtonText: "Sure",
declineButtonText: "Nope"
});
if (userWantsToPutStar) {
window.open("https://github.com/Djaler/vue-promise-dialogs");
}
},
},
});
</script>
<style scoped>
main {
display: flex;
flex-direction: column;
justify-content: center;
min-height: calc(100vh - 2rem);
}
footer {
display: flex;
justify-content: right;
padding: 0 1rem;
}
</style>