ZZJ
2022-02-11 d365829b14ca4256d39694b9cdcd43bad0ad8595
src/pages/desktop/index/components/DFrame.vue
@@ -84,11 +84,7 @@
    data: Object,
  },
  created() {
    window.addEventListener("message", (e) => {
      if (e.data.msg === "showBack") {
        this.isShowBack = true;
      }
    });
    this.addBackListener();
  },
  data() {
    return {
@@ -221,15 +217,31 @@
      //return false;
    },
    // 菜单栏返回
    back() {
      let active = this.$store.state.desktop.minDocks;
      active = active.filter((item) => item.highlight);
      console.log(`返回${active.alt}`);
      console.log(active);
      const iframeArr = document.querySelectorAll("iframe");
      iframeArr.forEach((item) => {
        item.contentWindow.postMessage({ msg: `返回${active[0].alt}` }, "*");
      });
    },
    // 添加返回按钮相关监听
    addBackListener() {
      //显示返回按钮
      window.addEventListener("message", (e) => {
        if (e.data.msg === "showBack") {
          this.isShowBack = true;
        }
      });
      //隐藏返回按钮
      window.addEventListener("message", (e) => {
        if (e.data.msg === "hiddenBack") {
          this.isShowBack = false;
        }
      });
    },
  },
  directives: {
    drag(el, binding) {