vue中获取dom元素的宽高 template模板中给dom绑定ref: <el-carousel id="ailabelmap" ref="remarkCarusel" height="70vh" > </el-carousel> js代码中获取: const width = this.$refs.remarkCarusel.$el.offsetWidth const height = this.$refs.remarkCarusel.$el.offsetHeight