gpt4 book ai didi

javascript - 如何以编程方式设置 HTMLElement 的宽度?

转载 作者:行者123 更新时间:2023-11-28 14:28:57 24 4
gpt4 key购买 nike

refs: {
someElement: HTMLDivElement;
};

this.$refs.someElement.clientWidth = 100;

我得到:

Cannot assign to 'clientWidth' because it is a constant or a read-only property.

Cannot assign to 'offsetWidth' because it is a constant or a read-only property.

最佳答案

尝试

this.$refs.someElement.style.width = '100px';

关于javascript - 如何以编程方式设置 HTMLElement 的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52205894/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com