<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                >[success] # 惰性載入函數 ~~~ 1.下面利用閉包let getCss = functio(){} 第一次執行時候做好了屬性兼容的判斷,此時 getCss = function 將let 定義的函數重新賦值并且保留作用域,可以看閉包章節具體解釋,可以參考下面小閉包案例來理解下面 整個大案例 function a() { let x = 1 a = function () { x += 1 console.log(x) } } a() // 當a執行完后內部定義a = function(){} 因為沒有let const var 等聲明此時a已經定義在全局 a() // 2 重新定義的a 內部x 引用上級作用域即之前a中let x= 1 內存因為被新的a=function 占用未被釋放 a() // 3 因此也形成閉包 在做一些一次性質即可時使用這種案例思想 ~~~ ~~~ // + getComputedStyle([Element])[ATTR] 獲取當前元素所有經過瀏覽器計算的樣式 // + [Element].currentStyle[ATTR] IE6~8 // 弊端:第一次執行,需要校驗一下兼容性;但是后續每一次執行,都需要重新校驗 “這個操作是多余的”... /* let getCss = function getCss(ele, attr) { if ('getComputedStyle' in window) { return window.getComputedStyle(ele)[attr]; } return ele.currentStyle[attr]; }; console.log(getCss(box, 'width')); console.log(getCss(box, 'padding')); console.log(getCss(box, 'display')); */ let getCss = function (ele, attr) { if ('getComputedStyle' in window) { getCss = function (ele, attr) { return window.getComputedStyle(ele)[attr]; }; } else { getCss = function (ele, attr) { return ele.currentStyle[attr]; }; } return getCss(ele, attr); }; console.log(getCss(box, 'width')); console.log(getCss(box, 'padding')); console.log(getCss(box, 'display')); ~~~ [惰性函數載入參考 ](http://www.zhangyunling.com/375.html)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看