首先要保证你的div要在<template></template>里面,然后可以这样写

<div class="sub-window-wrapper" :style="dynamicStyles"></div>


下面是呼应

computed: {
  dynamicStyles() {
    let browserWidth = window.innerWidth;
    let halfVideoWidth = this.videoWidth/2;
    let videoMarginLeft = (browserWidth-halfVideoWidth)/2;
    console.log("videoMarginLeft is:" + videoMarginLeft)
    return {
      width: halfVideoWidth + "px",
      // marginLeft: "560px",
      marginLeft: videoMarginLeft + "px",
      zIndex: 1,
      position: "relative",
    };
  },

},