Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想更改使用创建的元素的样式document.createElement("button")。
document.createElement("button")
我尝试使用:
element.style.width = "50px"
但是,找不到样式字段。
Element需要转换为更具体的类型HTMLElement:
Element
HTMLElement
val button = document.createElement("button") as HTMLElement button.style.width = "50px"