首页 > TAG信息列表 > HTMLInputElement

React报错之Property 'value' does not exist on type 'HTMLElement'

正文从这开始~ 总览 当我们试图访问一个类型为HTMLElement的元素上的value属性时,会产生"Property 'value' does not exist on type 'HTMLElement'"错误。为了解决该错误,在访问属性之前,使用类型断言将元素类型断言为HTMLInputElement。 这里有个示例用来展示错误是如何发生的。 //