VUE获取div距离顶部的距离 麻辣小辣鸡 2022-07-08 762 阅读1分钟 方法一: this.$refs.contentBox.getBoundingClientRect().top 方法二: this.$refs.contentBox.offsetTop