Skip to content

Commit 74ceeb6

Browse files
committed
Chore(app): demo app clean-up
1 parent 9f77704 commit 74ceeb6

File tree

6 files changed

+53
-48
lines changed

6 files changed

+53
-48
lines changed

Diff for: src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import HelloWorld from './components/HelloWorld.vue'
1212

1313
<nav>
1414
<RouterLink to="/">Home</RouterLink>
15-
<RouterLink to="/vue">Vue</RouterLink>
15+
<RouterLink to="/comp">Comp</RouterLink>
1616
<RouterLink to="/about">About</RouterLink>
1717
</nav>
1818
</div>

Diff for: src/assets/main.css

-13
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,3 @@ a,
2020
background-color: hsla(160, 100%, 37%, 0.2);
2121
}
2222
}
23-
24-
@media (min-width: 1024px) {
25-
body {
26-
display: flex;
27-
place-items: center;
28-
}
29-
30-
#app {
31-
display: grid;
32-
grid-template-columns: 1fr 1fr;
33-
padding: 0 2rem;
34-
}
35-
}

Diff for: src/router/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createRouter, createWebHistory } from 'vue-router'
2-
import VueHomeView from '../views/VueHomeView.vue'
32
import IndexView from '../views/IndexView.vue'
43

54
const router = createRouter({
@@ -11,9 +10,9 @@ const router = createRouter({
1110
component: IndexView
1211
},
1312
{
14-
path: '/vue',
15-
name: 'vue',
16-
component: VueHomeView
13+
path: '/comp',
14+
name: 'comp',
15+
component: () => import('../views/CompView.vue')
1716
},
1817
{
1918
path: '/about',

Diff for: src/views/AboutView.vue

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1+
<script setup lang="ts">
2+
import TheWelcome from '../components/TheWelcome.vue'
3+
</script>
4+
15
<template>
2-
<div class="about">
3-
<h1>This is an about page</h1>
4-
</div>
6+
<main>
7+
<TheWelcome />
8+
</main>
59
</template>
6-
7-
<style>
8-
@media (min-width: 1024px) {
9-
.about {
10-
min-height: 100vh;
11-
display: flex;
12-
align-items: center;
13-
}
14-
}
15-
</style>

Diff for: src/views/CompView.vue

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div class="index">
3+
<h1 style="text-align: center;margin-bottom: 35px;margin-top: 35px;">Comp page</h1>
4+
5+
</div>
6+
</template>
7+
8+
<script lang="ts" setup>
9+
import { inject } from "vue";
10+
11+
const dialog = inject('$dialog')
12+
const openDialog = () => dialog.alert('Hello world!')
13+
</script>
14+
15+
<style>
16+
@media (min-width: 1024px) {
17+
.index {
18+
max-width: 700px;
19+
}
20+
}
21+
</style>

Diff for: src/views/IndexView.vue

+21-17
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
<div class="index">
33
<h1 style="text-align: center;margin-bottom: 35px;margin-top: 35px;">Index page</h1>
44
<div style="width: 100%;display: grid; grid-gap: 15px; grid-template-columns: repeat(auto-fill, 200px);justify-content: center">
5-
<button class="dg-btn" @click="testBtnHandler('alert')">Click Alert</button>
6-
<button class="dg-btn" @click="testBtnHandler('confirm')">Click Confirm</button>
7-
<button class="dg-btn" @click="testBtnHandler('soft')">Click Confirm | soft</button>
8-
<button class="dg-btn" @click="testBtnHandler('loading')">Click Confirm | loading</button>
9-
<button class="dg-btn" @click="testBtnHandler('hard')">Click Confirm | hard</button>
10-
<button class="dg-btn" @click="testBtnHandler('prompt')">Click Prompt</button>
5+
<button class="dg-btn" @click="testBtnHandler('alert')">Alert</button>
6+
<button class="dg-btn" @click="testBtnHandler('confirm')">Confirm</button>
7+
<button class="dg-btn" @click="testBtnHandler('prompt')">Prompt</button>
8+
<button class="dg-btn" @click="testBtnHandler('soft')">Confirm | soft</button>
9+
<button class="dg-btn" @click="testBtnHandler('loading')">Confirm | loading</button>
10+
<button class="dg-btn" @click="testBtnHandler('hard')">Confirm | hard</button>
11+
<button class="dg-btn" @click="openDialog()">Open from setup</button>
1112
</div>
1213
<hr style="margin: 35px 0;" />
1314
<div style="width: 100%;display: grid; grid-gap: 15px; grid-template-columns: repeat(auto-fill, 200px);justify-content: center">
14-
<button class="dg-btn" v-confirm="'Please confirm!'">Click Directive</button>
15-
<a href="https://example.com" v-confirm:soft="'Visit external link?'">Example website</a>
16-
To see how many seconds have elapsed, click <a href="javascript:" v-confirm="`${secondsElapsed} Seconds`">here</a>
15+
<div><button class="dg-btn" v-confirm="'Please confirm!'">Directive</button></div>
16+
<div><a href="https://example.com" v-confirm:soft="'Visit external link?'">Example website</a></div>
17+
<div>To see how many seconds have elapsed, click <a href="javascript:" v-confirm="`${secondsElapsed} Seconds`">here</a></div>
1718
</div>
1819
</div>
1920
</template>
2021

2122
<script lang="ts">
22-
import {defineComponent, nextTick, ref} from "vue";
23+
import {defineComponent, inject, ref} from "vue";
2324
2425
export default defineComponent({
2526
methods: {
@@ -28,7 +29,12 @@ export default defineComponent({
2829
this[type]();
2930
},
3031
alert() {
31-
this.$dialog.alert('Hello world!')
32+
this.$dialog.alert({
33+
title: 'Request failed',
34+
body: 'The requested resource is no longer available. It may have been moved or deleted',
35+
}, {
36+
okText: 'Dismiss'
37+
})
3238
},
3339
confirm() {
3440
this.$dialog.confirm('If you delete this record, it\'ll be gone forever.')
@@ -82,13 +88,15 @@ export default defineComponent({
8288
},
8389
},
8490
setup() {
91+
const dialog = inject('$dialog')
92+
const openDialog = () => dialog.alert('Hello world!')
8593
const secondsElapsed = ref(0)
8694
const tick = () => {
8795
secondsElapsed.value += 1
8896
setTimeout(() => tick(), 1000)
8997
}
9098
tick()
91-
return { secondsElapsed }
99+
return { secondsElapsed, openDialog }
92100
}
93101
})
94102
@@ -97,11 +105,7 @@ export default defineComponent({
97105
<style>
98106
@media (min-width: 1024px) {
99107
.index {
100-
min-height: 100vh;
101-
display: flex;
102-
flex-direction: column;
103-
align-items: center;
104-
justify-content: center;
108+
max-width: 700px;
105109
}
106110
107111
.dg-btn {

0 commit comments

Comments
 (0)