ModalLogout.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <a-modal width="420px" :visible="showModal" @ok="handleOk" @cancel="handleCancel" :okText="$t('login.okBtn')"
  3. :cancelText="$t('login.cancelBtn')" unmountOnClose>
  4. <template #title><icon-exclamation-circle-fill class="tips-icon" /> {{ $t('login.tip') }} </template>
  5. <div>{{ $t('login.okText') }}</div>
  6. </a-modal>
  7. </template>
  8. <script setup>
  9. import { computed } from 'vue';
  10. import { useRouter } from 'vue-router';
  11. import { kuky_Authorization } from '../../../base/storage';
  12. import { resetHasRouteFlag } from '../../../router/guard';
  13. const props = defineProps({
  14. visible: {
  15. type: Boolean,
  16. default: false
  17. }
  18. });
  19. const emit = defineEmits(['update:visible']);
  20. const router = useRouter();
  21. const showModal = computed(() => props.visible);
  22. const handleOk = () => {
  23. kuky_Authorization.remove();
  24. // 重置路由守卫标志位
  25. resetHasRouteFlag();
  26. router.push({ path: '/login', replace: true });
  27. emit('update:visible', false);
  28. };
  29. const handleCancel = () => {
  30. emit('update:visible', false);
  31. };
  32. </script>
  33. <style scoped lang="css">
  34. .tips-icon {
  35. font-size: 20px;
  36. color: rgb(var(--orange-6));
  37. }
  38. </style>