组件修改

This commit is contained in:
2025-12-20 12:55:43 +08:00
parent 1498b91bcf
commit 89ff8a7dba
11 changed files with 150 additions and 277 deletions

View File

@@ -137,29 +137,12 @@
<!-- 主内容区 -->
<main class="main-content">
<!-- iframe 模式 -->
<div v-if="currentIframeUrl" class="iframe-container">
<div class="iframe-header">
<span class="iframe-title">{{ currentMenuItem?.label }}</span>
<el-button
text
@click="handleRefreshIframe"
:icon="Refresh"
>
刷新
</el-button>
</div>
<iframe
ref="iframeRef"
:src="currentIframeUrl"
class="content-iframe"
frameborder="0"
@load="handleIframeLoad"
/>
<div v-if="iframeLoading" class="iframe-loading">
<Loader :size="20" class="is-loading" />
<span>加载中...</span>
</div>
</div>
<IframeView
v-if="currentIframeUrl"
:url="currentIframeUrl"
:title="currentMenuItem?.label"
:show-header="true"
/>
<!-- 路由模式 -->
<router-view v-else />
@@ -177,13 +160,9 @@ import {
Server,
Monitor,
ChevronDown,
ChevronRight,
RefreshCw,
Loader
ChevronRight
} from 'lucide-vue-next'
// el-button 刷新图标需要传入组件
const Refresh = RefreshCw
import { IframeView } from '@/components'
// ... (rest of the code remains the same)
import type { MenuItem } from '@/types/menu'
@@ -287,8 +266,6 @@ const serviceTitle = computed(() => {
// 状态管理
const collapsed = ref(false)
const activeMenu = ref('home')
const iframeLoading = ref(false)
const iframeRef = ref<HTMLIFrameElement>()
// 从 LocalStorage 获取用户名
function getUserName(): string {
@@ -488,22 +465,6 @@ const handleMenuClick = (item: MenuItem) => {
// 所有菜单都通过路由跳转
if (item.url) {
router.push(item.url)
if (item.viewType === 'iframe') {
iframeLoading.value = true
}
}
}
// iframe 加载完成
const handleIframeLoad = () => {
iframeLoading.value = false
}
// 刷新 iframe
const handleRefreshIframe = () => {
if (iframeRef.value) {
iframeLoading.value = true
iframeRef.value.src = iframeRef.value.src
}
}