11<template >
22 <div >
3- <q-dialog transition-show =" jump-down" transition-hide =" jump-up" v-model =" myDialogParams.visible" persistent @before-hide =" handlerBeforeHide" >
3+ <q-dialog
4+ transition-show =" slide-left"
5+ transition-hide =" slide-right"
6+ v-model =" myDialogParams.visible"
7+ @before-hide =" handlerBeforeHide"
8+ position =" right"
9+ full-height
10+ :persistent =" myDialogParams.persistent"
11+ >
412 <q-card class =" my-dialog" :style =" calcMyDialogWidth" >
5- <div class =" title f-bold q-pa-md text-h6" >
6- {{ myDialogParams.title }}
13+ <div class =" title q-pa-md row items-center" >
14+ <span class =" text-h6 f-bold" >{{ myDialogParams.title }}</span >
15+ <q-icon class =" q-ml-auto" name =" close" @click =" handlerClickCancel" size =" 20px" v-if =" myDialogParams.showClose" />
716 </div >
817 <div class =" split-line h-1" ></div >
918 <div class =" scroll content" style =" max-height : 500px " >
1423 <div class =" q-px-md q-pb-md" >
1524 <slot name =" extra-description" />
1625 </div >
17- <div class =" split-line h-1" ></div >
18- <div class =" text-center q-pa-md row justify-end" >
19- <q-btn :label =" $t(`action.cancel`)" :disable =" myDialogParams.clickLoading" @click =" handlerClickCancel()" outline color =" primary" />
20- <q-btn :label =" $t(`action.confirm`)" color =" primary" class =" q-ml-md" @click =" handlerClickDialogConfirmButton()" :loading =" myDialogParams.clickLoading" v-show =" myDialogParams.showConfirm" />
21- </div >
26+ <q-card-actions class =" actions q-pa-none" >
27+ <div class =" q-pa-md full-width text-right" >
28+ <div class =" split-line h-1 q-my-md" ></div >
29+ <q-btn :label =" $t(`action.cancel`)" :disable =" myDialogParams.clickLoading" @click =" handlerClickCancel()" outline color =" primary" />
30+ <q-btn
31+ :label =" $t(`action.confirm`)"
32+ color =" primary"
33+ class =" q-ml-md"
34+ @click =" handlerClickDialogConfirmButton()"
35+ :loading =" myDialogParams.clickLoading"
36+ v-show =" myDialogParams.showConfirm"
37+ />
38+ </div >
39+ </q-card-actions >
2240 </q-card >
2341 </q-dialog >
2442 </div >
@@ -40,6 +58,8 @@ interface IOption {
4058 params: any ;
4159 customComfirm: boolean ;
4260 noTwiceConfirm: boolean ;
61+ persistent? : boolean ;
62+ showClose? : boolean ;
4363}
4464
4565const DEFAULT_OPTION: IOption = {
@@ -53,6 +73,8 @@ const DEFAULT_OPTION: IOption = {
5373 params: {},
5474 customComfirm: false ,
5575 noTwiceConfirm: false ,
76+ persistent: true ,
77+ showClose: true ,
5678};
5779
5880@Component ({
@@ -176,6 +198,9 @@ export default class MyDialogComponent extends Vue {
176198 type: this .myDialogParams .dialogType ,
177199 params: this .myDialogParams .params ,
178200 });
201+ if (! this .myDialogParams .persistent ) {
202+ this .$emit (' close' , { type: this .myDialogParams .dialogType });
203+ }
179204 }
180205
181206 public validForm() {
@@ -198,6 +223,10 @@ export default class MyDialogComponent extends Vue {
198223 }
199224 }
200225 }
226+
227+ .actions {
228+ background : #000000 ;
229+ }
201230}
202231
203232.body--light {
@@ -212,10 +241,16 @@ export default class MyDialogComponent extends Vue {
212241 }
213242 }
214243 }
244+
245+ .actions {
246+ background : #ffffff ;
247+ }
215248}
216249
217250.my-dialog {
218- border-radius : 12px ;
251+ border-radius : 12px 0 0 12px !important ;
252+ display : flex ;
253+ flex-direction : column ;
219254
220255 .title {
221256 padding : 16px ;
@@ -226,5 +261,10 @@ export default class MyDialogComponent extends Vue {
226261 .content {
227262 padding : 16px ;
228263 }
264+
265+ .actions {
266+ width : 100% ;
267+ margin-top : auto ;
268+ }
229269}
230270 </style >
0 commit comments