iframe页面缓存问题 切换iframe搜索字段内容不会清除

相当于一个显示隐藏 通过判断当前页面是否为iframe页面 如果是就展示 否则就隐藏

<template>
  <div
    id="main-container"
    class="main-container"
    :class="{ 'head-bar-collapse-width': isCollapse }"
  >
    <transition name="fade" mode="out-in">
      <keep-alive exclude="Customer,Supplier" :include="cacheView">
        <router-view :key="$route.path" v-if="status"></router-view>
      </keep-alive>
    </transition>
    <IFrame v-show="this.$route.name.__file"></IFrame>
  </div>
</template>

<script>
import IFrame from "../IFrame/IFrame";
export default {
  name: "MainContent",
  components: {
    IFrame,
  },
  data() {
    return {
      status: true,
    };
  },
  computed: {
    cacheView: function () {
      return this.$store.state.tag.tags.map(this.myFunction);
    },
  },
  props: {
    isCollapse: {
      type: Boolean,
      default: false,
    },
  },
  watch: {
    $route() {
      if (this.$route.name.__file) {
        this.status = false;
      } else {
        this.status = true;
      }
      // 判断当前路由是否iframe页
    },
  },
  mounted() {},

  methods: {
    myFunction(c) {
      return c.enName;
      // }
    },
  },
};
</script>
<style lang="scss" scoped>
.main-container {
  position: fixed;
  top: 85px;
  left: 146px;
  right: 1px;
  bottom: 0px;
  padding: 0 20px 0;
  color: #676a6c;
  background: #f4f4f4;

  overflow-y: auto;
  //  z-index: 10129;
}
.head-bar-collapse-width {
  left: 56px;
  transition-property: all;
  -webkit-transition-property: all; /* Safari */
  -webkit-transition-duration: 0.4s; /* Safari */
}
// .fade-leave-active,
// .fade-enter-active {
//   transition: all 0.5s;
// }

// .fade-enter {
//   opacity: 0;
//   transform: translateX(-30px);
// }
</style>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jiojio冲冲冲

能帮助你是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值