mounted() {
    let that = this;
    // <!--把window.onresize事件挂在到mounted函数上-->
    window.onresize = () => {
      return (() => {
        window.fullHeight = document.documentElement.clientHeight;
        window.fullWidth = document.documentElement.clientWidth;
        that.windowHeight = window.fullHeight; //
        that.windowWidth = window.fullWidth; //
      })();
    };
  },
watch: {
      windowHeight (val) {
        let that = this;
        // console.log("实时屏幕高度:",val, that.windowHeight );
      },
      windowWidth (val) {
        let that = this;
        // console.log("实时屏幕宽度:",val, that.windowHeight );
      }
    },
data() {
    return {
      circleUrl:
        "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
      size: "small",
      isCollapse: false,
      windowWidth: document.documentElement.clientWidth, //实时屏幕宽度
      windowHeight: document.documentElement.clientHeight //实时屏幕高度
    };
  },

 

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2022-01-05
  • 2021-10-23
猜你喜欢
  • 2021-05-31
  • 2022-12-23
  • 2021-06-08
  • 2021-10-04
相关资源
相似解决方案