可视化大屏适配方案一window.onresize监听窗口变化
<template> <div class="datav" ref="datav" /> </template> export default{ mounted(){ this.pageResize(); window.onresize = () => { this.pageResize(); }; } } methods: { pageResize() { let windowWidth = document.body.clientWidth; if (windowWidth != 1920) { let scaleNum = Number.parseFloat((windowWidth / 1920).toFixed(3)); if (windowWidth <= 1366) { scaleNum += 0.008; } this.$refs.datav.style = `transform-origin: 0 0 0;transform: scale(${scaleNum});`; } }, }