1. <i id='uEI5g'><tr id='uEI5g'><dt id='uEI5g'><q id='uEI5g'><span id='uEI5g'><b id='uEI5g'><form id='uEI5g'><ins id='uEI5g'></ins><ul id='uEI5g'></ul><sub id='uEI5g'></sub></form><legend id='uEI5g'></legend><bdo id='uEI5g'><pre id='uEI5g'><center id='uEI5g'></center></pre></bdo></b><th id='uEI5g'></th></span></q></dt></tr></i><div id='uEI5g'><tfoot id='uEI5g'></tfoot><dl id='uEI5g'><fieldset id='uEI5g'></fieldset></dl></div>

      <small id='uEI5g'></small><noframes id='uEI5g'>

        <bdo id='uEI5g'></bdo><ul id='uEI5g'></ul>

        <tfoot id='uEI5g'></tfoot>
      1. <legend id='uEI5g'><style id='uEI5g'><dir id='uEI5g'><q id='uEI5g'></q></dir></style></legend>
      2. 打字稿,'NodeListOf&lt;Element&gt;'不是数组类型或字符串类型

        Typescript,#39;NodeListOflt;Elementgt;#39; is not an array type or a string type(打字稿,NodeListOflt;Elementgt;不是数组类型或字符串类型)

        <small id='xDGw2'></small><noframes id='xDGw2'>

              • <legend id='xDGw2'><style id='xDGw2'><dir id='xDGw2'><q id='xDGw2'></q></dir></style></legend>
                <i id='xDGw2'><tr id='xDGw2'><dt id='xDGw2'><q id='xDGw2'><span id='xDGw2'><b id='xDGw2'><form id='xDGw2'><ins id='xDGw2'></ins><ul id='xDGw2'></ul><sub id='xDGw2'></sub></form><legend id='xDGw2'></legend><bdo id='xDGw2'><pre id='xDGw2'><center id='xDGw2'></center></pre></bdo></b><th id='xDGw2'></th></span></q></dt></tr></i><div id='xDGw2'><tfoot id='xDGw2'></tfoot><dl id='xDGw2'><fieldset id='xDGw2'></fieldset></dl></div>

                  <bdo id='xDGw2'></bdo><ul id='xDGw2'></ul>
                    <tbody id='xDGw2'></tbody>
                  <tfoot id='xDGw2'></tfoot>
                • 本文介绍了打字稿,'NodeListOf&lt;Element&gt;'不是数组类型或字符串类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  Converting my JS to TS strict mode.

                  The following syntax looks fine to me but TS is complaining in the for loop on allSubMenus with:

                  [ts] Type 'NodeListOf<Element>' is not an array type or a string type.
                  

                  What am I missing?

                  function subAct(target:Node){
                  
                    const allSubMenus : NodeListOf<Element> = document.querySelectorAll('.subMenuItems') 
                  
                    for (const sub of allSubMenus){
                      sub.classList.remove('active')
                    }  
                  }
                  

                  解决方案

                  You need to set the target compiler option to es6 or higher for NodeListOf<T> to be iterable.

                  这篇关于打字稿,'NodeListOf&lt;Element&gt;'不是数组类型或字符串类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)
                  getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)

                      <tfoot id='g0i47'></tfoot>

                      <small id='g0i47'></small><noframes id='g0i47'>

                        <tbody id='g0i47'></tbody>
                        <bdo id='g0i47'></bdo><ul id='g0i47'></ul>
                          1. <i id='g0i47'><tr id='g0i47'><dt id='g0i47'><q id='g0i47'><span id='g0i47'><b id='g0i47'><form id='g0i47'><ins id='g0i47'></ins><ul id='g0i47'></ul><sub id='g0i47'></sub></form><legend id='g0i47'></legend><bdo id='g0i47'><pre id='g0i47'><center id='g0i47'></center></pre></bdo></b><th id='g0i47'></th></span></q></dt></tr></i><div id='g0i47'><tfoot id='g0i47'></tfoot><dl id='g0i47'><fieldset id='g0i47'></fieldset></dl></div>

                            <legend id='g0i47'><style id='g0i47'><dir id='g0i47'><q id='g0i47'></q></dir></style></legend>