Vue en tiempo real pasado ancho y alto de página

montado () { 
    let that = this ;
     // <! - Cuelgue el evento window.onresize en la función 
    montada- > window.onresize = () => {
       return (() => { 
        window.fullHeight = document .documentElement.clientHeight; 
        window.fullWidth = document.documentElement.clientWidth; 
        that.windowHeight = window.fullHeight; // Alto 
        that.windowWidth = window.fullWidth; // Width 
      }) (); 
    }; 
  },
watch: { 
      windowHeight (val) { 
        let that = this ;
         // console.log ("Altura de pantalla en vivo:", val, that.windowHeight); 
      }, 
      windowWidth (val) { 
        let that = this ;
         // console.log ("Ancho de pantalla en tiempo real:", val, that.windowHeight); 
      } 
    },
data () {
     return { 
      circleUrl: 
        " https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png " , 
      size: " small " , 
      isCollapse: false , 
      windowWidth: document.documentElement.clientWidth, // Pantalla en tiempo real Ancho 
      windowHeight: document.documentElement.clientHeight // Altura de pantalla en tiempo real 
    }; 
  },

 

Supongo que te gusta

Origin www.cnblogs.com/wangshishuai/p/12727150.html
Recomendado
Clasificación