123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <!-- <router-view></router-view> -->
- <router-view v-slot="{ Component }">
- <transition name="ranimate">
- <component :is="Component" />
- </transition>
- </router-view>
- </template>
- <script setup lang="ts">
- import { provide } from 'vue'
- import { useStore } from '@/store/index'
- import { ElNotification, NotificationParamsTyped } from 'element-plus'
- const { setAsyncRoutesMark } = useStore()
- window.addEventListener('beforeunload', () => beforeunloadFn())
- const beforeunloadFn = (() => {
- setAsyncRoutesMark(false)
- })
- provide<GlobalPopup>('globalPopup', {
- showSuccess: (message?: string) => {
- notificationTiop({
- message: message || '成功',
- type: 'success',
- title: "提示",
- duration: 2000
- })
- }, //!SECTION 成功
- showError: (message?: string) => notificationTiop({
- message: message || '失败',
- type: 'error',
- title: "提示",
- duration: 2000
- }), //!SECTION 失败
- showWarning: (message: string) => notificationTiop({
- message,
- type: 'warning',
- title: "提示",
- duration: 2000
- }), //!SECTION 警告
- showInfo: (message: string) => notificationTiop({
- message,
- type: 'info',
- title: "提示",
- duration: 2000
- }), //!SECTION 文本
- })
- const notificationTiop = (options: NotificationParamsTyped) => {
- ElNotification(options)
- }
- </script>
- <style>
- html,
- body,
- #app,
- .layouts {
- width: 100%;
- height: 100%;
- /* overflow: hidden; */
- min-width: 650px;
- }
- * {
- font-family: '微软雅黑';
- }
- /* home 页面的动画 */
- .router_animate-enter-active {
- animation: slideInLeft 0.5s;
- }
- .router_animate-leave-active {
- animation: slideOutLeft 0s;
- }
- /* app 路由动画 */
- .ranimate-enter-active {
- animation: fadeIn 1s;
- }
-
- .ranimate-leave-active {
- animation: fadeIn 0s;
- }
- </style>
|