vue项目iframe切换菜单刷新问题

方案

针对iframe组件,平铺渲染,切换菜单也不做删除

<template>
  <component v-for="item in views" :is="item.component" :style="getStyle(item)" class="iframe-box"></component>
</template>

<script setup lang="ts">
import { computed } from "vue";
import tagsView from "@/store/modules/tags-view.ts";
import routerMenu from "@/store/modules/router-menu.ts";

const getStyle = computed(() => {
  return function(item) {
    return {
      display: routerMenu().currentRoute.fullPath == item.fullPath ? "block" : "none",
      flex: "0"
    };
  };
});
const views = computed(() => {
  return tagsView().iframeViews;
})
</script>

<style>
.iframe-box {
  flex: 1 !important;
  overflow: hidden;
}
</style>
posted @ 2025-07-16 14:58  fight139  阅读(24)  评论(0)    收藏  举报