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

鍍金池/ 問答/ HTML問答
喵小咪 回答

router是一個總的狀態(tài)管理,route是向router注冊路由與頁面關(guān)系的一個組件,NavLink是對router產(chǎn)生的 context.router 利用的一個組件。router只接受一個內(nèi)容區(qū)

  <Router>
        <div>
            <div className='head'>
                <Nav/>
            </div>
            <div className='body'>
                  <Route exact path="/" component={A} />
                  <Route  path="/b" component={B} />
                  <Route  path="/c" component={C} />
            </div>
        </div>   
    </Router>

可以這樣寫

孤客 回答

1、利用progress-stream獲取上傳進度

如果只是想在服務(wù)端獲取上傳進度,可以試下如下代碼。注意,這個模塊跟express、multer并不是強綁定關(guān)系,可以獨立使用。

var fs = require('fs');
var express = require('express');
var multer  = require('multer');
var progressStream = require('progress-stream');

var app = express();
var upload = multer({ dest: 'upload/' });

app.post('/upload', function (req, res, next) {
    // 創(chuàng)建progress stream的實例
    var progress = progressStream({length: '0'}); // 注意這里 length 設(shè)置為 '0'
    req.pipe(progress);
    progress.headers = req.headers;
    
    // 獲取上傳文件的真實長度(針對 multipart)
    progress.on('length', function nowIKnowMyLength (actualLength) {
        console.log('actualLength: %s', actualLength);
        progress.setLength(actualLength);
    });

    // 獲取上傳進度
    progress.on('progress', function (obj) {        
        console.log('progress: %s', obj.percentage);
    });

    // 實際上傳文件
    upload.single('logo')(progress, res, next);
});

app.post('/upload', function (req, res, next) {
    res.send({ret_code: '0'});
});

app.get('/form', function(req, res, next){
    var form = fs.readFileSync('./form.html', {encoding: 'utf8'});
    res.send(form);
});

app.listen(3000);

2、獲取上傳文件的真實大小

multipart類型,需要監(jiān)聽length來獲取文件真實大小。(官方文檔里是通過conviction事件,其實是有問題的)

    // 獲取上傳文件的真實長度(針對 multipart)
    progress.on('length', function nowIKnowMyLength (actualLength) {
        console.log('actualLength: %s', actualLength);
        progress.setLength(actualLength);
    });

3、關(guān)于progress-stream獲取真實文件大小的bug?

針對multipart文件上傳,progress-stream 實例子初始化時,參數(shù)length需要傳遞非數(shù)值類型,不然你獲取到的進度要一直是0,最后就直接跳到100。

至于為什么會這樣,應(yīng)該是 progress-steram 模塊的bug,看下模塊的源碼。當(dāng)length是number類型時,代碼直接跳過,因此你length一直被認(rèn)為是0。

    tr.on('pipe', function(stream) {
        if (typeof length === 'number') return;
        // Support http module
        if (stream.readable && !stream.writable && stream.headers) {
            return onlength(parseInt(stream.headers['content-length'] || 0));
        }

        // Support streams with a length property
        if (typeof stream.length === 'number') {
            return onlength(stream.length);
        }

        // Support request module
        stream.on('response', function(res) {
            if (!res || !res.headers) return;
            if (res.headers['content-encoding'] === 'gzip') return;
            if (res.headers['content-length']) {
                return onlength(parseInt(res.headers['content-length']));
            }
        });
    });

參考鏈接

https://github.com/expressjs/...
https://github.com/freeall/pr...

耍太極 回答

router的path值寫錯了,找不到這個路徑,導(dǎo)致組件內(nèi)容無法掛載.

兔寶寶 回答

emit的時候要帶上index和value啊,不然父組件不知道是哪個子組件傳上來的

抱緊我 回答

這里的toString()方法不是這個實例obj內(nèi)的方法
是Object原型的方法
Object.prototype.toString()
https://developer.mozilla.org...

陌上花 回答
createSphere: function() {
  var cosTheta = Math.random() * 2 - 1,
    sinTheta = Math.sqrt(1 - cosTheta * cosTheta),
    phi = Math.random() * 2 * Math.PI;

  return {
    x: this.SCATTER_RADIUS * sinTheta * Math.cos(phi),
    y: this.SCATTER_RADIUS * sinTheta * Math.sin(phi),
    z: this.SCATTER_RADIUS * cosTheta,
    hue: Math.round(phi / Math.PI * 30)
  };
},

參數(shù)方程

賤人曾 回答

指的是搜索城市嗎? 搜索城市就是根據(jù)關(guān)鍵字去遍歷所有城市,if唄.
遍歷用for循環(huán)啊.forEach還有其他的遍歷.

乞許 回答
<select class="form-control selectpicker" id="identity">
  <option data-content="<img src='/static/assets/images/zh.png' width='32' height='32' /><span style='vertical-align: middle;'>簡體中文</span>"></option>
  <option data-content="<img src='/static/assets/images/usa.png' width='32' height='32' /><span style='vertical-align: middle;'>English</span>"></option>
</select>

clipboard.png

雨蝶 回答

setState中很重要的三個功能是:

  1. 合并state
  2. 觸發(fā)調(diào)和算法和render
  3. 批量更新

而且并不是說只有setState才可以改變state。

舊螢火 回答

你想問的是軟鍵盤喚起的時候影響布局的事情嗎?如果是,請繼續(xù)往下看:
在移動端,軟鍵盤彈出,是會改變屏幕的大小的,這是必然的,所以在移動端盡量不要使用fixed進行布局。對于影響布局的解決方案,通用的做法就是監(jiān)聽屏幕的resize事件,如果屏幕高度小于原始高度,則把fixed布局display:none;,恢復(fù)高度的時候還原display屬性。

枕頭人 回答
  1. NoEmitOnErrorsPlugin的官方中文文檔翻譯里還有這樣一段
對于所有資源,統(tǒng)計資料(stat)的 emitted 標(biāo)識都是 false

webpacks配置參數(shù)中stats是用來配置輸出構(gòu)建日志級別的
看了下NoEmitOnErrorsPlugin的源碼部分,其中有這一段,捕獲到日志錯誤時,返回false,即不輸出錯誤日志

if(compilation.getStats().hasErrors())
                return false;
  1. 這個問題,我也不太理解,只能說說我的見解。首先他是cli命令 ,啟用了WDS服務(wù),--inline表示默認(rèn)內(nèi)聯(lián)模式運行,--progress表示輸出構(gòu)建過程。這部分發(fā)生錯誤時,其實應(yīng)該已經(jīng)報錯了,只是構(gòu)建錯誤應(yīng)該輸出到控制臺里了,而這里不中斷應(yīng)該是WDS本身啟用了watch模式的關(guān)系
老梗 回答

給圖片加一個時間戳參數(shù)唄

耍太極 回答

你這就是選擇$(".lllll>div")中的第一個div。
應(yīng)該這么寫

$(.lllll>div:first-child).click(function(){
//code
})
孤星 回答

升級到layerUI2.0以上的版本,直接用API控制,你會發(fā)現(xiàn)質(zhì)的飛躍

青黛色 回答

因為是寫在vue文件里。

會先經(jīng)過vue-loader編譯成 require('logo.png'),然后在經(jīng)過file-loader。

算了你自己看文檔吧。

https://vue-loader.vuejs.org/...

你的瞳 回答

zzzzz
左上角的x就是關(guān)瀏覽器的意思,你點返回才是回上個畫面