鍍金池/ 問答/ HTML問答
澐染 回答

修改請求頭可以配置一下axios

//創(chuàng)建實(shí)例 axios.create([config])
const instance=axios.create({
  // `timeout` 指定請求超時(shí)的毫秒數(shù)(0 表示無超時(shí)時(shí)間)
  timeout:2000,
  // `headers` 是即將被發(fā)送的自定義請求頭
  headers:{
    'Content-Type':'application/x-www-form-urlencoded'
  }
});
故人嘆 回答

有復(fù)制node_module文件夾么?如果有。刪掉直接npm install

誮惜顏 回答
提問前,代碼請勿使用圖片

假設(shè)你的兩個(gè)promise分別是 Func1()Func2()

let pr_task = [Func1,Func2];
Promise.all(pr_task).then(function(){
    //Here,code  After All Promise
})

根據(jù)問題的補(bǔ)充

fetch('http://10.3.134.173/jsonp-test/data/dish_getbypage.php?start=1',
    ).then((response)=>
        response.json()
    ).then((res)=>{
        console.log(res[0].name);
    });
fetch('http://10.3.134.173/jsonp-test/data/dish_getbypage.php?start=2',
    ).then((response)=>
        response.json()
    ).then((res)=>{
        console.log(res[0].name);
    })

如果你是想等 fetch('http://10.3.134.173/jsonp-test/data/dish_getbypage.php?start=1'),那么直接

let pr_task = [];
pr_task.push(fetch('http://10.3.134.173/jsonp-test/data/dish_getbypage.php?start=1'))
pr_task.push(fetch('http://10.3.134.173/jsonp-test/data/dish_getbypage.php?start=2'))

Promise.all(pr_task).then(function(){
    //Here,code  After All Promise
})

只要保證pr_task這個(gè)數(shù)組的值都是一個(gè)promise,那么Promise.all()就會(huì)等待所有的數(shù)據(jù),并且按照原數(shù)組的順序給出resolve的結(jié)果組成的一個(gè)數(shù)組

雅痞 回答

試試 給浮動(dòng)層的 left right 都設(shè)置為0

柒槿年 回答

這詭異的格式是怎么回事...

案1. 處理錯(cuò)誤的格式,如

file:                     
   File { 

改為

file: { 

案2. 用正則表達(dá)式

案3. 讓后臺(tái)傳正確的Json(推薦)

詆毀你 回答

vue class component 是vue 官方出的
vue property decorator 是社區(qū)出的
其中vue class component 提供了 vue component 等等
vue property decorator 深度依賴了 vue class component 拓展出了很多操作符 @Prop @Emit @Inject 等等 可以說是 vue class component 的一個(gè)超集
正常開發(fā)的時(shí)候 你只需要使用 vue property decorator 中提供的操作符即可 不用再從vue class componen 引入vue component

吃藕丑 回答

不用想的那么復(fù)雜,組件不是給你提供tab-click事件了嗎,直接在回調(diào)里面滾動(dòng)條回到頂部啊window.scrollTo(0, 0);

薔薇花 回答

因?yàn)?code>Array在js里面是 引用類型,雖然你console.log在前push在后,但是因?yàn)?strong>引用類型是傳址不是傳值,所以你在控制臺(tái)看到的數(shù)組會(huì)隨著數(shù)組的后繼操作而更新

故林 回答

你沒貼代碼,就用官網(wǎng)的例子吧

// instantiate a loader
var loader = new THREE.OBJLoader();

// load a resource
loader.load(
    // resource URL
    'models/monster.obj',
    // called when resource is loaded
    function ( object ) {

        scene.add( object );
        //你加載完模型,要把模型add到場景中吧
        //后面加個(gè)標(biāo)志判斷不就可以了,比如bool數(shù)組,或者map什么的,最簡單的加載數(shù)量int也可以
        cnt += 1; //加載成功數(shù)+1
        if(cnt > 10) {//全部加載完
            //todo
        }
    },
    // called when loading is in progresses
    function ( xhr ) {

        console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );

    },
    // called when loading has errors
    function ( error ) {

        console.log( 'An error happened' );

    }
);
別硬撐 回答

:sort-method在遍歷的時(shí)候只會(huì)渲染一次,不適合拖拽換位,這里需要換一個(gè)方法
在表頭添加排序change的方法
clipboard.png
該方法有三個(gè)參數(shù),通過判斷直接修改table里的:data值來實(shí)現(xiàn)排序.
clipboard.png

慢半拍 回答

1,這其實(shí)是塊級作用域的問題,并沒有涉及到閉包。
2,產(chǎn)生原因在于var與let使用的作用域不同。
var 變量的作用域是全局,而let 是局部的塊作用域即for循環(huán)內(nèi),
全局變量唯一性,var 聲明的變量i在循環(huán)中被不斷覆蓋最終只是唯一的10,因此在外部調(diào)用中無論li的哪一個(gè),最終都是10。
而let是局部的作用域,并不會(huì)被覆蓋。

執(zhí)念 回答

我的 webpack.prod.conf.js 配置

plugins: [
...
new ParallelUglifyPlugin({
  cacheDir: '.cache/',
  uglifyJS: {
    output: {
      comments: false
    },
    compress: {
      warnings: false
    }
  },
  sourceMap: config.build.productionSourceMap
}),
...
]

打包沒問題

念舊 回答

我的思路是,你子組件雙向綁定的那個(gè)值,不要直接用父組件傳給他的,彈窗打開的時(shí)候,做一個(gè)動(dòng)作,就是聲明一個(gè)新的值,然后把父組件的值傳給他(需要深復(fù)制),然后你子組件就直接綁定新聲明的那個(gè)值;然后彈窗關(guān)閉的時(shí)候,如果是保存關(guān)閉,那就把你新聲明的那個(gè)值傳給父組件,讓父組件去更新這個(gè)值,就是vue的自定義事件,$emit和$on;如果是未保存關(guān)閉,那么久不用做任何其他操作,直接關(guān)閉子組件就好了。