Skip to content

Commit

Permalink
Merge pull request #345 from ybkuroki/develop
Browse files Browse the repository at this point in the history
Fix remain some issues
  • Loading branch information
ybkuroki authored Aug 12, 2023
2 parents aa47289 + 028c381 commit 45693c6
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
43 changes: 43 additions & 0 deletions src/components/Dialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<script setup lang="ts">
import { useDialogPluginComponent } from 'quasar'
const props = defineProps({
title: { type: String, required: true },
message: { type: String, required: true },
cancel: { type: Boolean, defalut: false },
persistent: { type: Boolean, defalut: false },
})
defineEmits([
// REQUIRED; need to specify some events that your
// component will emit through useDialogPluginComponent()
...useDialogPluginComponent.emits
])
const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = useDialogPluginComponent()
// dialogRef - Vue ref to be applied to QDialog
// onDialogHide - Function to be used as handler for @hide on QDialog
// onDialogOK - Function to call to settle dialog with "ok" outcome
// example: onDialogOK() - no payload
// example: onDialogOK({ /*...*/ }) - with payload
// onDialogCancel - Function to call to settle dialog with "cancel" outcome
</script>

<template>
<q-dialog ref="dialogRef" @hide="onDialogHide" :persistent="persistent">
<q-card class="q-dialog-plugin">
<q-card-section>
<div class="text-indigo text-h6">{{ title }}</div>
</q-card-section>

<q-card-section>
<div class="text-subtitle2">{{ message }}</div>
</q-card-section>

<q-card-actions align="right">
<q-btn flat class="text-indigo text-bold" label="OK" @click="onDialogOK" />
<q-btn v-if="cancel" flat class="text-indigo text-bold" label="Cancel" @click="onDialogCancel" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
4 changes: 2 additions & 2 deletions src/components/ViewBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ setStore()
<q-drawer class="bg-indigo-5" v-model="leftDrawerOpen" bordered>
<q-scroll-area class="fit">
<q-list>
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple @click="$router.push('/home')">
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple to="/home" exact>
<q-item-section avatar>
<q-icon name="home" />
</q-item-section>
Expand All @@ -82,7 +82,7 @@ setStore()
</q-item-section>
</q-item>
<q-separator />
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple @click="$router.push('/about')">
<q-item clickable class="text-white" active-class="bg-indigo-8" v-ripple to="/about" exact>
<q-item-section avatar>
<q-icon name="info" />
</q-item-section>
Expand Down
13 changes: 9 additions & 4 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { computed } from "vue";
import type { QVueGlobals } from "quasar";
import { useCategoryStore } from '@/stores/category'
import { useFormatStore } from '@/stores/format'
import Dialog from '@/components/Dialog.vue'

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

export const confirm = ($q: QVueGlobals, message: string, onOk: () => void, onCancel: () => void) => {
$q.dialog({
title: 'Confirm',
message: message,
cancel: true,
persistent: true
component: Dialog,

componentProps: {
title: 'Confirm',
message: message,
cancel: true,
persistent: true
},
}).onOk(() => {
onOk()
}).onCancel(() => {
Expand Down
8 changes: 7 additions & 1 deletion src/views/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Notify } from "quasar";
const user = ref("");
const password = ref("");
const isLoading = ref(false)
const isPwd = ref(true)
const router = useRouter()
Expand Down Expand Up @@ -46,10 +47,15 @@ const login = () => {
<q-icon name="person" />
</template>
</q-input>
<q-input square filled clearable v-model="password" type="password" label="Password" tabindex="2">
<q-input square filled v-model="password" :type="isPwd ? 'password' : 'text'" label="Password"
tabindex="2">
<template v-slot:prepend>
<q-icon name="lock" />
</template>
<template v-slot:append>
<q-icon :name="isPwd ? 'visibility_off' : 'visibility'" class="cursor-pointer"
@click="isPwd = !isPwd" />
</template>
</q-input>
</q-form>
</q-card-section>
Expand Down

0 comments on commit 45693c6

Please sign in to comment.