Memo

 

1.Webpack: node_modules/css/index.js didn't return a function  

  npm install css-loader style-loader --save-dev

2.更改webpack 端口

webpack-dev-server --hot --host 127.0.0.1 --port 9999 

3.jquery相關重疊形成的混亂

    <ul>
        <li>index</li>
        <li>foo</li>
        <li>foo2</li>
    </ul>
    <div id="cc">
    </div>
    <script>
        $(function(){
          $("li" ).each(function( index ) {
              $("div").append("<div>"+index+ ":"+$(this).text()+"</div>");
          });
       });
    </script>
  瀏覽器渲染成這樣:

                                                                                       

我理解就是選擇器與添加元素,重疊形成的混亂
$("div").append("<div>"+index+ ":"+$(this).text()+"</div>");
明確一個ID就行了
$("#cc").append("<div>"+index+ ":"+$(this).dtext()+"</div>");

4.禁用在UC上點到圖片顯示看圖模式

img { pointer-events: none; } 

5.jquery children和find

.children( [selector ] )Returns: jQuerycss

Description: Get the children of each element in the set of matched elements, optionally filtered by a selector.html

Given a jQuery object that represents a set of DOM elements, the .children() method allows us to search through the children of these elements in the DOM tree and construct a new jQuery object from the matching elements. The .children()method differs from .find() in that .children() only travels a single level down the DOM tree while .find() can traverse down multiple levels to select descendant elements (grandchildren, etc.) as well. Note also that like most jQuery methods, .children() does not return text nodes; to get all children including text and comment nodes, use .contents().vue

The .children() method optionally accepts a selector expression of the same type that we can pass to the $() function. If the selector is supplied, the elements will be filtered by testing whether they match it.node

.find( selector )Returns: jQueryjquery

Description: Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.webpack

Given a jQuery object that represents a set of DOM elements, the .find() method allows us to search through the descendants of these elements in the DOM tree and construct a new jQuery object from the matching elements. The .find()and .children() methods are similar, except that the latter only travels a single level down the DOM tree.web

The first signature for the .find()method accepts a selector expression of the same type that we can pass to the $()function. The elements will be filtered by testing whether they match this selector.express

children() 不返回文本節點npm

.find().children()方法類似,可是children()只是查找子元素,返回的是兒子輩兒的,不是後代元素,參數可選。api

而find()方法是返回匹配元素集合中每一個元素的後代,參數必選。find()方法只在後代中遍歷,不包括本身。

if($(「table:eq(「+j+」)」).find(「tbody tr:nth-child(「+i+」)」).children(「td:nth-child(2)」).text()==」直航」)

if($(「table:eq(「+j+」)」).children(「tbody」).children(「tr:nth-child(「+i+」)」).children(「td:nth-child(2)」).text()==」直航」)

6.監測當前瀏覽器是否支持download屬性

  var isSupportDownload = 'download' in document.createElement('a');

7.微信瀏覽器緩存

  部分時候頁面跳轉會有緩存,頁面不變更。傳一個動參就行了。

8.兼容trim

 兼容舊環境若是 trim() 不存在,能夠在全部代碼前執行下面代碼

if (!String.prototype.trim) {
  String.prototype.trim = function () {
    return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  };
}
 

9.IE10+ 半透明自動隱藏的滾動條

/* IE10+ 半透明自動隱藏的滾動條 */ @-ms-viewport { width: device-width; }

CSS 自定義滾動條樣式 適用於 webkit 內核瀏覽器

 
::-webkit-scrollbar 滾動條總體部分 ::-webkit-scrollbar-thumb 滾動條裏面的小方塊,能向上向下移動(或往左往右移動,取決因而垂直滾動條仍是水平滾動條) ::-webkit-scrollbar-track 滾動條的軌道(裏面裝有Thumb) ::-webkit-scrollbar-button 滾動條的軌道的兩端按鈕,容許經過點擊微調小方塊的位置。 ::-webkit-scrollbar-track-piece 內層軌道,滾動條中間部分(除去) ::-webkit-scrollbar-corner 邊角,即兩個滾動條的交匯處 ::-webkit-resizer 兩個滾動條的交匯處上用於經過拖動調整元素大小的小控件

10.改完JS文件夾版本號真的挺重要的。今天不當心疏忽了

11.今天寫按着一篇博文寫vue-demo 在外部引入CSS的時候,最後發現老是報

You may need an appropriate loader to handle this file type.

我按着博主的原文看了看 對比一下,沒有哪不對。但就是不行。最後發現 ,在webpack.config.js 裏 這則項不對

{
test: /\\.css$/, loader: "style!css" },

相關文章
相關標籤/搜索