Skip to content

Commit 45693c6

Browse files
authoredAug 12, 2023
Merge pull request #345 from ybkuroki/develop
Fix remain some issues
2 parents aa47289 + 028c381 commit 45693c6

File tree

4 files changed

+61
-7
lines changed

4 files changed

+61
-7
lines changed
 

‎src/components/Dialog.vue

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<script setup lang="ts">
2+
import { useDialogPluginComponent } from 'quasar'
3+
4+
const props = defineProps({
5+
title: { type: String, required: true },
6+
message: { type: String, required: true },
7+
cancel: { type: Boolean, defalut: false },
8+
persistent: { type: Boolean, defalut: false },
9+
})
10+
11+
defineEmits([
12+
// REQUIRED; need to specify some events that your
13+
// component will emit through useDialogPluginComponent()
14+
...useDialogPluginComponent.emits
15+
])
16+
17+
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent()
18+
// dialogRef - Vue ref to be applied to QDialog
19+
// onDialogHide - Function to be used as handler for @hide on QDialog
20+
// onDialogOK - Function to call to settle dialog with "ok" outcome
21+
// example: onDialogOK() - no payload
22+
// example: onDialogOK({ /*...*/ }) - with payload
23+
// onDialogCancel - Function to call to settle dialog with "cancel" outcome
24+
</script>
25+
26+
<template>
27+
<q-dialog ref="dialogRef" @hide="onDialogHide" :persistent="persistent">
28+
<q-card class="q-dialog-plugin">
29+
<q-card-section>
30+
<div class="text-indigo text-h6">{{ title }}</div>
31+
</q-card-section>
32+
33+
<q-card-section>
34+
<div class="text-subtitle2">{{ message }}</div>
35+
</q-card-section>
36+
37+
<q-card-actions align="right">
38+
<q-btn flat class="text-indigo text-bold" label="OK" @click="onDialogOK" />
39+
<q-btn v-if="cancel" flat class="text-indigo text-bold" label="Cancel" @click="onDialogCancel" />
40+
</q-card-actions>
41+
</q-card>
42+
</q-dialog>
43+
</template>

‎src/components/ViewBase.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ setStore()
6464
<q-drawer class="bg-indigo-5" v-model="leftDrawerOpen" bordered>
6565
<q-scroll-area class="fit">
6666
<q-list>
67-
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple @click="$router.push('/home')">
67+
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple to="/home" exact>
6868
<q-item-section avatar>
6969
<q-icon name="home" />
7070
</q-item-section>
@@ -82,7 +82,7 @@ setStore()
8282
</q-item-section>
8383
</q-item>
8484
<q-separator />
85-
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple @click="$router.push('/about')">
85+
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple to="/about" exact>
8686
<q-item-section avatar>
8787
<q-icon name="info" />
8888
</q-item-section>

‎src/components/index.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { computed } from "vue";
22
import type { QVueGlobals } from "quasar";
33
import { useCategoryStore } from '@/stores/category'
44
import { useFormatStore } from '@/stores/format'
5+
import Dialog from '@/components/Dialog.vue'
56

67
export const categories = computed(() => {
78
const store = useCategoryStore()
@@ -15,10 +16,14 @@ export const formats = computed(() => {
1516

1617
export const confirm = ($q: QVueGlobals, message: string, onOk: () => void, onCancel: () => void) => {
1718
$q.dialog({
18-
title: 'Confirm',
19-
message: message,
20-
cancel: true,
21-
persistent: true
19+
component: Dialog,
20+
21+
componentProps: {
22+
title: 'Confirm',
23+
message: message,
24+
cancel: true,
25+
persistent: true
26+
},
2227
}).onOk(() => {
2328
onOk()
2429
}).onCancel(() => {

‎src/views/LoginView.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Notify } from "quasar";
99
const user = ref("");
1010
const password = ref("");
1111
const isLoading = ref(false)
12+
const isPwd = ref(true)
1213
1314
const router = useRouter()
1415
@@ -46,10 +47,15 @@ const login = () => {
4647
<q-icon name="person" />
4748
</template>
4849
</q-input>
49-
<q-input square filled clearable v-model="password" type="password" label="Password" tabindex="2">
50+
<q-input square filled v-model="password" :type="isPwd ? 'password' : 'text'" label="Password"
51+
tabindex="2">
5052
<template v-slot:prepend>
5153
<q-icon name="lock" />
5254
</template>
55+
<template v-slot:append>
56+
<q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer"
57+
@click="isPwd = !isPwd" />
58+
</template>
5359
</q-input>
5460
</q-form>
5561
</q-card-section>

0 commit comments

Comments
 (0)
Please sign in to comment.