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

鍍金池/ 問答
焚音 回答

樓主,如果你已經(jīng)排好序的話,是不是要這個效果:

var newDataArray = dataList.reduce((target,current)=>{
    if(target[target.length-1] == null || target[target.length-1][target[target.length-1].length - 1].categoryName !== current.categoryName) {
        target.push([current])
    } else {
        target[target.length-1].push(current)
    }
    return target

}, []);

console.log(newDataArray)
失心人 回答

沒有css-loader你可以單獨安裝,這種問題應(yīng)該是不同依賴環(huán)境造成的。

或者簡單粗暴,把node卸載了,裝你同事那個版本

冷咖啡 回答
  1. debouncethrottle是目前用得最廣泛的,具體可見樓上的一堆收藏;
  2. 想要確保邏輯上不會有同時提交的請求,npm搜“mutex”也有很多;
  3. 或者我也寫了一個簡易版的,用下面的函數(shù)包裹點擊回調(diào),如果前一次請求尚未結(jié)束,新請求會和舊請求一起返回。這樣的話回調(diào)要返回Promise

    const debounceAsync = originalFunction => {
      let currentExcution = null;
      const wrappedFunction = async function () {
        // 1. locked => return lock
        if (currentExcution) return currentExcution;
    
        // 2. released => apply
        currentExcution = originalFunction.apply(this, arguments);
        try {
          return await currentExcution;
        }
        finally {
          currentExcution = null;
        }
      };
      return wrappedFunction;
    };

    用法

    const sleep = (ms = 0) => new Promise(resolve => setTimeout(resolve, ms));
    
    const debounceAsync_UNIT_TEST = async () => {
      const goodnight = debounceAsync(sleep);
      for (let i = 0; i < 8; i++) {
        goodnight(5000).then(() => console.log(Date()));
        await sleep(500);
      }
      console.warn('Expected output: 8 identical datetime');
    };

    https://segmentfault.com/a/11...

念舊 回答

看人家返回給你的是什么內(nèi)容了,如果是blob,這樣

jsFileDownload (filename, data, mime) {
    let blob = new Blob([data], {type: mime || 'application/octet-stream'})
    if (typeof window.navigator.msSaveBlob !== 'undefined') {
      window.navigator.msSaveBlob(blob, filename)
    } else {
      var blobURL = window.URL.createObjectURL(blob)
      var tempLink = document.createElement('a')
      tempLink.style.display = 'none'
      tempLink.href = blobURL
      tempLink.setAttribute('download', filename)
      if (typeof tempLink.download === 'undefined') {
        tempLink.setAttribute('target', '_blank')
      }
      document.body.appendChild(tempLink)
      tempLink.click()
      document.body.removeChild(tempLink)
      window.URL.revokeObjectURL(blobURL)
    }
  }

如果是url,那就很簡單了,沒必要我寫了

未命名 回答

1.給對話框元素添加一個屬性isEdit,點擊添加按鈕的時候給這個屬性設(shè)置為false,點擊編輯的時候給這個屬性設(shè)置為true,在保存的時候獲取這個屬性判斷
2.當(dāng)然也可以把isEdit存為全局變量

尕筱澄 回答

你這個壓縮圖片有問題
this.compress(vm.temp.base64Img);傳入的是base64格式的字符串
canvas.width = img.width; canvas.height = img.height;這里base64格式的字符串是獲取不到寬高的
這句canvas.toDataURL("image/jpeg", 0.15)你之前沒有把圖片畫到canvas上所以的canvas上是空的

callback:

compress(base64img,callback) {
    var img = new Image();
    img.src = base64img;
    img.onload = function(){
        var width = img.width;
        var height = img.height;
        var canvas = document.createElement("canvas");
        canvas.width = width;
        canvas.height = height;
        canvas.getContext("2d").drawImage(img,0,0,width,height);
        callback(canvas.toDataURL("image/jpeg", 0.15))
    }
}
//調(diào)用
vm.compress(vm.temp.base64img, function (base64img) {
    uploadImage({ base64img }).then(response => {
        const data = response.data;
        //...
    });
});

promise:

function compress(base64img, callback) {
    return new Promise(function (resolve) {
        var img = new Image();
        img.src = base64img;
        img.onload = function () {
            var width = img.width;
            var height = img.height;
            var canvas = document.createElement("canvas");
            canvas.width = width;
            canvas.height = height;
            canvas.getContext("2d").drawImage(img, 0, 0, width, height);
            resolve(canvas.toDataURL("image/jpeg", 0.15))
        }
    })
}
//調(diào)用
vm.compress(vm.temp.base64img)
    .then(base64img => uploadImage({ base64img }))
    .then(response => {
        const data = response.data;
        //...
    });
陌離殤 回答

jquery對象和dom對象,jquery方法和dom方法了解一下

氕氘氚 回答

<a>你給 state.text 設(shè)置一個初始值看可以展示嗎?
<b>還有那個InputItem的屬性名不是value而是val嗎?antd路人答

antd的doc上看并未發(fā)現(xiàn)inputItem組件value屬性有一個別名叫val的。樓主還是按照第<a>的方式看下可以嗎?不行的話就是val屬性有問題了

咕嚕嚕 回答

我找到答案了,是我的錯。我取出的時候應(yīng)該:

this.$route.params.is_used這樣取出.

尋仙 回答

你這個寫法應(yīng)該是 vue-router 吧, vue-router 常見有三種格式的路由守衛(wèi):

1) 全局路由守衛(wèi)

如 beforeEach, afterEach

2) 路由獨享守衛(wèi)

如 beforeEnter

3) 組件獨享守衛(wèi)

如 beforeRouterEnter, beforeRouterUpdate, beforeRouterLeave

他們的應(yīng)用場景各不相同,你問的太寬泛,所以都有可能。

檸檬藍 回答

寫個傳參方法,調(diào)用10次

苦妄 回答

https://a.com/user/account
a.com 對應(yīng)于服務(wù)器上的某個文件夾,user/account 是文件夾下底下的某個資源,由于使用了vue-route,這些資源在這個文件夾里是不存在,所以返回 404 ,所以服務(wù)器需要做url rewrite, 把所有請求都指向 index.html 這個文件是真實存在的.

官方給出了大部分服務(wù)器的配置方式:https://router.vuejs.org/zh-c...

或者使用默認的hash方式, 
https://a.com/#/user/account, 這里的#分割符號之后的內(nèi)容都是服務(wù)器的路徑,只是一些參數(shù)(甚至理解為注釋),(還有URL中第一次出現(xiàn)的?是GET參數(shù)分隔符,也不會去查找), 所以不需要服務(wù)器作任何處理,因為所有的請求,都是指向index.html的.

應(yīng)該能解決第二個問題,
第一個問題不太理解,多說一句加了 .html 就是另一個資源.

命于你 回答

跨域了,請求的地址不允許來自'http://localhost:8080'的請求

柒喵 回答

那要看看你的ctx為什么是個Promise

互擼娃 回答

代碼 1 中,數(shù)組 result 中的函數(shù)都引用的 createFunctions 中的變量,而 for 循環(huán)結(jié)束之后,i 的值為 10,所以你打印出來的都是 10。

這實際是 閉包延遲計算 的問題:

result[i] = function() {
            return i;
};  // 在執(zhí)行 這個語句的時候,解釋器并沒有計算 i 的值,直到你調(diào)用 `result[i]` 的時候,這時 i 已經(jīng)是 10 了
練命 回答

http -> upgrade -> 服務(wù)器同意 -> 升級為websocket -> 該干嘛干嘛
一不一個頁面沒什么所謂。

笑浮塵 回答

已經(jīng)解決,就是數(shù)組最高元素的數(shù)值

焚音 回答
e.target.classList.add('className')
//e.target.classList.remove('className')