123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <template>
- <router-view v-slot="{ Component }">
- <keep-alive include="Home">
- <component :is="Component" />
- </keep-alive>
- </router-view>
- </template>
- <script setup lang="ts">
- import { onMounted, onBeforeUnmount, watch, computed } from 'vue';
- import { useRouter } from 'vue-router';
- const router = useRouter();
- const handleLinkClick = (e: MouseEvent) => {
- const target = (e.target as HTMLElement).closest('a') as HTMLAnchorElement | null;
- if (target && target.tagName === 'A' && target.href) {
- e.preventDefault();
- window.open(target.href, '_blank', 'noopener,noreferrer');
- }
- };
- onMounted(() => {
- if (location.pathname !== '/') {
- router.push('/');
- }
- document.addEventListener('click', handleLinkClick);
- });
- onBeforeUnmount(() => {
- document.removeEventListener('click', handleLinkClick);
- });
- </script>
- <style>
- /* 全局样式 */
- .help-tip {
- width: 540px;
- /* height: 110px; */
- display: flex;
- flex-direction: column;
- /* box-sizing: border-box; */
- padding: 20px 20px !important;
- .title {
- font-weight: bold;
- font-size: 16px;
- color: #282e30;
- margin-bottom: 10px;
- }
- .value {
- font-weight: 400;
- font-size: 14px;
- color: #282e30;
- }
- }
- </style>
|