mounted() {
    if (navigator.userAgent.match(/(iPhone|Android|iPad)/i)) {
      let width = document.documentElement.clientWidth;
      let height = document.documentElement.clientHeight;
      if (width < height) {
        alert("手机屏幕横过来嗷");
        this.loading = true;
        document.getElementById("loading").style.zIndex = 2021;
        window.addEventListener("resize", this.renderResize);
      }
    }
  },
  beforeUnmount() {
    window.removeEventListener("resize", this.renderResize);
  },
  methods: {
    renderResize() {
      let width = document.documentElement.clientWidth;
      let height = document.documentElement.clientHeight;
      if (width > height) {
        this.loading = false;
        document.getElementById("loading").style.zIndex = -5;
      } else {
        this.loading = true;
        document.getElementById("loading").style.zIndex = 2021;
      }
    },
  },

Logo

前往低代码交流专区

更多推荐