原文:解决这个报错:Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

因为在input标签用了type number , 导致报错 说明:从chrome 版本开始, chrome浏览器只支持获取type为text, search, URL, tel and password的input元素的selectionStart, selectionEnd 和 setSelectionRange 属性, 在其余类型中尝试获取这些属性chrome会提示错误。 解决方法: 在n ...

2021-03-10 14:50 0 387 推荐指数:

查看详情

nuxt生产环境报错:Failed to execute 'appendChild' on 'Node': This node type does not support this method...

初次用nuxt,发现它的坑还真不少,一个坑能坑你很久,这里我给大家做一个汇总 今天在打包测试环境的时候发现启动项目,浏览器里报标题所示的错误,乍一看,不知所措,就开始找原因,你会发现,在本地开发的时候同样也有报错 这里还给你列出了出问题的父级和子级元素,看起来还挺人性化,然后找到 ...

Mon Mar 21 08:46:00 CST 2022 0 1838
解决TS报错Property 'style' does not exist on type 'Element'

在使用queryselector获取一个dom元素,编译时却报错说property 'style' does not exist on type 'element'。 原因:这是typescript的类型检查导致的,需要在querySelector方法前面加个类型断言。 扩展 ...

Fri Dec 21 22:58:00 CST 2018 0 10561
Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

今天复习了一下关于getComputedStyle的用法,遇到了小小的挫折。报错前的代码: 当然,这只是随便举的例子,然而却遇到了标题上面的报错,纠结了一会后,终于解决了。原来是获取dom元素时,应该通过标签中的id属性去获取,这样仅需要改为 var box ...

Tue Jul 16 07:08:00 CST 2019 0 3957
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM