All files / components/popup GlobalPopupV2.vue

88.46% Statements 46/52
100% Branches 1/1
33.33% Functions 1/3
88.46% Lines 46/52

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 521x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x             3x 3x 3x 1x
<template>
    <q-dialog v-model="isOpen" persistent transition-show="scale" transition-hide="scale">
      <q-card class="container" style="border-radius: 20px">
        <div class="center">
          <q-icon :name="`img:/${popupFlag(status).img}`" size="150px" class="img"/>
        </div>
        <q-card-section class="q-pa-none">
          <div class="text-h3 title q-pt-none">{{popupFlag(status).title}} </div>
        </q-card-section>
          <q-card-section class="q-pa-none">
            <div class="content">{{popupFlag(status).body}}</div>
          </q-card-section>
          <q-card-actions align="center" flat class="pt-b">
            <q-btn 
              class="btn" 
              :class="popupFlag(status).class" 
              flat 
              @click="onClose(status)"
              :label="popupFlag(status).label" 
              size="lg" 
              v-close-popup
            />
          </q-card-actions>
      </q-card>
    </q-dialog>
  </template>
  
  <script lang="ts">
import { popupFlag } from "@/common/function";
import { useRouter } from 'vue-router';
  
  export default {
    props: {
      isOpen:Boolean,
      status:String
    },
    emits:["on-close"],
    setup(props:any,context:any){
      const router = useRouter()
        return{
          popupFlag,
            onClose(status:string){
              if(status=='success' ||status=='paid'||status=='update'){
                router.go(-1)
              }else{
                context.emit('on-close', false)
              }
            }
        }
    }
  }
  </script>