根据id获取元素的宽度的方法

1.方式一

document.getElementById("app").style.width
2.方式二:
const el = document.getElementById('app')
console.log(window.getComputedStyle(el).width)
posted @ 2024-05-18 11:46  埃菲尔上的加菲猫  阅读(46)  评论(0编辑  收藏  举报