12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <template>
- <router-view></router-view>
- </template>
- <script setup lang="ts">
- import { onMounted, ref, provide, inject } from 'vue'
- import { useStore } from '@/store/index'
- import { ElNotification } from 'element-plus'
- const { setAsyncRoutesMark } = useStore()
- window.addEventListener('beforeunload', () => beforeunloadFn())
- const beforeunloadFn = (() => {
- setAsyncRoutesMark(false)
- })
- provide<GlobalPopup>('globalPopup', {
- showSuccess: (msg: string, time: number, icon: string) => { notificationTiop }, //!SECTION 成功
- showError: (msg: string, time: number, icon: string) => { notificationTiop }, //!SECTION 失败
- showWarning: (msg: string, time: number, icon: string) => { notificationTiop }, //!SECTION 警告
- showInfo: (msg: string, time: number, icon: string) => { notificationTiop }, //!SECTION 文本
- })
- const notificationTiop = (msg: string, time: number, icon: string, type: string) => {
- let obj: any = {}
- obj.title = '提示'
- obj.message = msg
- time ? obj.duration = time : obj.duration = 2000
- icon ? obj.iconClass = icon : obj.iconClass = ''
- type ? obj.type = type : obj.type = 'success'
- ElNotification(obj)
- }
- </script>
- <style>
- html,
- body,
- #app,
- .layouts {
- width: 100%;
- height: 100%;
- overflow: hidden;
- }
- </style>
|