vue获取元素宽、高、距离左边距离,右,上距离等还有XY坐标轴
this.$refs['通过设置ref获取到的dom元素'].getBoundingClientRect();//示例: 获取元素距离顶部的距离this.$refs.journalUpward.getBoundingClientRect().top// 获取组件高度this.$refs.top.$el.offsetHeight// 设置元素样式th...
·
this.$refs['通过设置ref获取到的dom元素'].getBoundingClientRect();
//示例: 获取元素距离顶部的距离
this.$refs.journalUpward.getBoundingClientRect().top
// 获取组件高度
this.$refs.top.$el.offsetHeight
// 设置元素样式
this.$refs.mask.style.top = 100 + 'px'
更多推荐
已为社区贡献7条内容
所有评论(0)