在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ HTML問答
抱緊我 回答

WebSocket的異常是異步的,你要用onerror方法獲取異常

ws = new WebSocket('ws://xxxxx:xxxx/');
ws.onerror = function(e) {
    console.log(e);
};
玄鳥 回答

你的curl代碼發(fā)的是post請(qǐng)求,file_get_contents發(fā)的是get請(qǐng)求。這個(gè)微信接口應(yīng)該是get請(qǐng)求

兮顏 回答

看你的題目應(yīng)該是想用原地排序,那我就順著你的思路來。

1.為了保證遞歸能記住位置,必須傳上一次排序的位置進(jìn)去,你想到了這一點(diǎn),但是參數(shù)沒有傳對(duì)。因?yàn)槟闶窃嘏判?,那么每次都要?code>arr傳進(jìn)去,同時(shí)還有本次排序的leftright

2.添加邊界條件,判斷是否進(jìn)行下次排序,可以在函數(shù)開始判斷,也可以在調(diào)用遞歸之前判斷

3.當(dāng)然第一次是不會(huì)傳leftright的,因此要判斷這兩個(gè)參數(shù),并賦默認(rèn)值

修改過后的方法如下:

var quickSort = function (arr, left, right) {

  // 是否進(jìn)行本次排序
  if (right <= left) return

  // 默認(rèn)值處理
  left = left || 0;
  right = right || arr.length - 1;

  var leftPoint = left;
  var rightPoint = right;
  var temp = arr[left];

  while (leftPoint != rightPoint) {

    while (arr[rightPoint] >= temp && leftPoint < rightPoint) {
      rightPoint--;
    }
    while (arr[leftPoint] <= temp && leftPoint < rightPoint) {
      leftPoint++;
    }
    if (leftPoint < rightPoint) {
      var changeNumber = arr[leftPoint];
      arr[leftPoint] = arr[rightPoint];
      arr[rightPoint] = changeNumber;
    }
  }

  arr[left] = arr[leftPoint];
  arr[leftPoint] = temp;

  quickSort(arr, left, leftPoint - 1)
  quickSort(arr, leftPoint + 1, right)

  return arr
};

原地排序節(jié)省空間,但是理解起來比另開空間的做法要困難一點(diǎn),因?yàn)槿潭际窃谠瓟?shù)組上進(jìn)行操作的

情未了 回答

cat UTC file , ciphertext is private key string.

風(fēng)畔 回答

兩種方法

.box li,.box2 li{
    width: 100px;
    height: 30px;
    display: inline-block;
    background: red;
}
.box li:nth-child(2n),
.box2 li:nth-child(2n){
    background: blue;
}
        
.box{
    width: 300px;
    white-space: nowrap;
    overflow-x: auto;
    border:1px solid #999
}
        
.box2{
    width: 300px;
    overflow-x: auto;
    border:1px solid #999
}
.box2{
    display: flex;
}
.box2 li{
    flex-shrink:0
}

<ul class="box">
    <li></li><li></li><li></li><li></li><li></li><li></li>
</ul>

<ul class="box2">
    <li></li><li></li><li></li><li></li><li></li><li></li>
</ul>
離觴 回答

不要用map。用foreach啊。map是不能跳出的

萌二代 回答
      '/api': {
            target: '192.168.100.100/au',
            changeOrigin: true
            pathRewrite: {
              '^/api': ''
            }
夢(mèng)囈 回答
exclude: [
  path.resolve(__dirname, "node_modules/xxx")
],
貓小柒 回答

別的話不多說,直接上代碼

<!DOCTYPE html>
<html>
<head>
  <title>Title</title>
  <script>
    window.onload = function () {
      function onGetLines() {
        var tmp = document.querySelector('#test').value;
        var lines = tmp.split(/\r*\n/);

        var linesCount = lines.length - (navigator.userAgent.indexOf('MSIE') !== -1);
        console.log('當(dāng)前文本行數(shù)', linesCount);
      }

      document.querySelector('#getLines').addEventListener('click', onGetLines, false)
    }
  </script>
</head>
<body>
<textarea name="test" id="test" cols="30" rows="10"></textarea>
<button id="getLines">獲取行數(shù)</button>
</body>
</html>
壞脾滊 回答

為什么parseDom不把div直接return出去
然后直接document.body.appendChild(parseDom("<h1>222</h1>text"))

function parseDom(html){
    var div = document.createElement("div");
    div.innerHTML = html;
    return div;
};
document.body.appendChild(parseDom("<h1>hhhh1</h1><span>sssspen</span>text text"));
不討囍 回答

大概思路如下:
設(shè)置默認(rèn)選中Checkbox的數(shù)量 state={checkboxNum:0};
選中一個(gè)Checkbox時(shí) 執(zhí)行事件 this.setState({checkboxNum:this.state.checkboxNum + 1});
遍歷的時(shí)候加判斷 <Checkbox disabled={ this.state.checkboxNum > 2 ? true : false}></Checkbox>

萢萢糖 回答

Promise來實(shí)現(xiàn)

function postImg(file){
    return new Promise(res => {
        var formdata = new FormData()
        formdata.append('img', file)
        axios.post(url, formdata)
        .then(result => {res(result)})
    })//這里返回每個(gè)圖片的上傳動(dòng)作的promise
}

var fileArr = []
//這里的數(shù)組是具體圖片file對(duì)象的數(shù)組
filePromises = fileArr.map(val => postImg(val))
//這里返回所有圖片上傳promise實(shí)例的數(shù)組
Promise.all(filePromises)
.then(val => {
    // 全部圖片上傳完的回調(diào)函數(shù)
})
過客 回答

用filter吧,符合條件的可以直接return,在配合存hash。

hash直接把值作為key是有坑的,比如[1, '1', [1]],這三個(gè)當(dāng)作key就一模一樣都是'1'。
用map也不行:

let map = new Map();
map.set([1], 'test');
map.get([1]) //undefined

前后的[1]不是同一個(gè)一樣取不到,還是object模擬hash配合類型判斷吧。


剛想了下,兩個(gè)[1]本來就不重復(fù),看需求吧,還是可以用map做hash的。

1.沒看懂你求的是什么數(shù)據(jù)的和
2.據(jù)我所知echarts的所有列的pattern必須是一樣的

拼未來 回答
The sort() method sorts the elements of an array in place and returns the array. The sort is not necessarily stable. The default sort order is according to string Unicode code points.

是Unicode,別的語(yǔ)言也需要排序。

Array.prototype.sort()

維他命 回答

http://javascript.ruanyifeng....

可以使用performance api

別傷我 回答
  1. paste 事件處理“粘貼”。

  2. 事件 event 中,通過 event.clipboardData.items 可以拿到內(nèi)容。

  3. itemgetAsFile() 方法可以得到一個(gè) blob 對(duì)象。

  4. 新瀏覽器,可以通過 FormData 直接處理這個(gè) blob 對(duì)象(直接以 multipart 方式提交了)。

大概的代碼:

// 處理粘貼事件
$(document).off('paste');
$(document).on('paste', function(eventObj) {
    var event = eventObj.originalEvent;

    var imageRe = new RegExp(/image\/.*/);
    var fileList = $.map(event.clipboardData.items, function (o) {
        if(!imageRe.test(o.type)){ return }
        var blob = o.getAsFile();
        return blob;
    });
    if(fileList.length <= 0){ return }

    srv.upload(fileList, function(name) { ... });
}

srv.upload 大概是:

function upload(fileList, callback) {

    for(var i = 0, l = fileList.length; i < l; i++){
        var fd = new FormData();
        var f = fileList[i];
        fd.append('filedata', f);

        var defer = $.ajax({
            url: config.upload,
            type: 'POST',
            dataType: 'json',
            data: fd,
            processData: false,
            contentType: false,
            xhrFields: { withCredentials: true },
            headers: {
                'Access-Control-Allow-Origin': '*',
                'Access-Control-Allow-Credentials': 'true'
            },
            success: callback(f.name) || angular.noop,
            error: callback(f.name) || angular.noop
        });
    }

}
柒槿年 回答

location? 你指的重定向地址是?

喵小咪 回答

既然保存按鈕在父組件,為什么不將要保存的所有信息以及用到的方法也存在父組件中呢?然后將父組件中的this 傳給子組件,子組件可以通過props 來得到數(shù)據(jù)或者改變數(shù)據(jù)。

<Child parent={this}/> // 這里將父組件的this傳給子組件;

//子組件通過
this.props.parent.state.父組件數(shù)據(jù); //拿到父組件的數(shù)據(jù)
this.props.parent.setState({父組件數(shù)據(jù):新數(shù)據(jù)});//改變父組件的數(shù)據(jù)
this.props.parent.父組件方法;//調(diào)用父組件的方法