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

鍍金池/ 問答
傻丟丟 回答

問題描述的不是很清楚

如果你想做的事情是: 當(dāng)前端傳入的數(shù)據(jù)為空字符串時(shí),在查詢時(shí)不對(duì)此字段做限制,只對(duì)前端傳了非空的字段進(jìn)行限制的話, mongodb的find方法是需要傳一個(gè)給定值的,傳空字符串 會(huì)匹配此字段為空的記錄, 你需要在執(zhí)行db查詢操作之前,
在nodejs代碼中判斷字符串是否為空,然后再執(zhí)行查詢語句。

不知是否幫到你,可以留言讓我進(jìn)一步了解你的問題。

補(bǔ)充回答:

以nodejs的express框架action請(qǐng)求為例:

const mongoClient = require('mongodb').MongoClient;
module.exports.get = function (req, res, next) {
    let queryEmail = req.query.email;
    
    mongoClient.connect(url, function (err, db) {
        if (err) throw error;
        let col = db.collection('your_collection');
        if (typeof queryEmail === 'string' && queryEmail.length === 0) {
            col.find({}).toArray(function (err, list) {
                if (err) throw error;
                res.json({
                    data: list
                });
            });
        }
        else {
            col.find({ email: queryEmail }).toArray(function (err, list) {
                if (err) throw error;
                res.json({
                    data: list
                });
            });
        }
        
    });
    
}

以上代碼只是幫你打個(gè)樣,僅對(duì)于email這一個(gè)字段的查詢, 當(dāng)輸入為空字符串時(shí),直接將查詢條件設(shè)為了空對(duì)象,因此不對(duì)任何字段做限制輸出查詢結(jié)果;如果email字段里有貨,則在查詢條件中限制email字段必須符合輸入值。
有問題請(qǐng)回復(fù)。

墻頭草 回答

err 肯定是作為回調(diào)函數(shù)的第一個(gè)參數(shù),所以你的 data 為空說明沒有錯(cuò)誤,你的 err 才是真正的返回結(jié)果:

data_true.find(function (data,err) {
        res.json(data);   
        res.json(err);    
});
命于你 回答

請(qǐng)更新您的開發(fā)工具!

挽歌 回答

Managed to get v3.0 and the image-drop module working with webpack

webpack.config.js:

module: {
  rules: [
    {
      test: /\.js$/,
      exclude: /node_modules(?!\/quill-image-drop-module|quill-image-resize-module)/,
      loader: 'babel-loader',
      query: {...}
    }
  ]
}
plugins: [
  new webpack.ProvidePlugin({
    'window.Quill': 'quill'
  })
]

Component.js:

import {ImageDrop} from 'quill-image-drop-module'
import ImageResize from 'quill-image-resize-module'

Quill.register('modules/imageResize', ImageResize)
Quill.register('modules/imageDrop', ImageDrop)

const quillModules = {
  ...
  imageDrop: true,
  imageResize: {}
}

You can also import the minified file from each module instead of transforming them with babel, but the image-drop module registers itself with Quill so you have to remove that.

最后在打包的時(shí)候,發(fā)現(xiàn)ImageDrop這個(gè)模塊壓縮又報(bào)錯(cuò)了。
最后干脆不用這個(gè)ImageDrop了。

殘淚 回答

一、對(duì)于前端

防止重復(fù)點(diǎn)擊按鈕:可以采用一點(diǎn)擊一次后讓按鈕置灰,暫時(shí)不可以用,響應(yīng)結(jié)束后再可以用。
防止重復(fù)提交請(qǐng)求:可以采用請(qǐng)求隊(duì)列的方式,每次請(qǐng)求時(shí)檢查隊(duì)列中有無該請(qǐng)求,有則返回,無則提交,并將該請(qǐng)求添加到隊(duì)列,響應(yīng)完畢,將響應(yīng)的請(qǐng)求從隊(duì)列中移除。

二、安全方面,需要前后端協(xié)同處理

推薦您看一下說說API的防重放機(jī)制

目前我們公司就采用這些方式!

你的瞳 回答

v-on:click簡(jiǎn)寫是為@click
最好不要操作dom,建議是在元素上加事件,將城市作為值傳過去。
<button id="hangzhou" @click="choice('杭州')"></button>
方法

methods:{
    choice:function(city){
        this.msg = city
    }
}
痞性 回答
demo()
.then(name => {
    console.log(name)
});

(async () => {
    const name = await demo()
    console.log(name)
})()

加一個(gè)分號(hào)就好了,那個(gè)地方j(luò)s執(zhí)行的時(shí)候把前后兩部分當(dāng)做函數(shù)執(zhí)行了。

大濕胸 回答
const randoms = {
    [Symbol.iterator]: function () {
        return {
            next: function () {
                var r = Math.random();
                if ( r < 0.9 )
                    return { value: r, done: false }
                else
                    return { value: null, done: true }
            }
        }
    }
}

let randomsPool = [];

for ( var random of randoms ) {
    randomsPool.push( random );
}
console.log( randomsPool )
拽很帥 回答

大概明白了。。是一個(gè)線程協(xié)作的問題?

為控件注冊(cè)一個(gè)在寬高可以獲取時(shí)觸發(fā)的監(jiān)聽器

這個(gè)相當(dāng)容易。。。不說話,看碼:

v.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                        @Override
                        public void onGlobalLayout() {
                            v.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                            int height=v.getHeight();
                        }
                    });

網(wǎng)絡(luò)請(qǐng)求線程

就提供一個(gè)思路,用ReentrantLock,在Activity#onCreate()lock.lock(),在OnGlobalLayoutListenerlock.unlock(),在線程中這么寫:

new Thread(new Runnable() {
                        @Override
                        public void run() {
                            //你的網(wǎng)絡(luò)請(qǐng)求處理。。。。
                            try {
                                lock.lock();
                                view.post(new Runnable() {
                                    @Override
                                    public void run() {
                                        LayoutParams lp=v.getLayoutParams().height=123;
                                        view.setLayoutParams(lp);
                                    }
                                });
                            }
                            finally {
                                lock.unlock();
                            }
                        }
                    }).start();

當(dāng)然這不是最佳方案。。。如果lock時(shí)機(jī)不對(duì)可能會(huì)導(dǎo)致鎖死。
如果你沒有更好的方案,用這個(gè)也未嘗不可。

如果還有問題歡迎追問

糖豆豆 回答

遍歷刪除commit提交版本里面的 aaa/aaa.txt 文件
git filter-branch --index-filter 'git rm --cached --ignore-unmatch aaa/aaa.txt' HEAD

心沉 回答

try_files $uri $uri/ /index.html;寫到server塊就行
比如

try_files $uri $uri/ /index.html;

location / {
  try_files $uri $uri/ /index.html;
}

location ~ (index.html|service-worker.js)$ {
  # ...
  add_header Last-Modified $date_gmt;
  add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
  if_modified_since off;
  expires off;
  etag off;
}
我甘愿 回答

react中真心不建議使用jquery。jquery操作真實(shí)dom后,reactdiff就無法實(shí)現(xiàn)render,所以出現(xiàn)很多問題根本無從查起。
react也有很強(qiáng)大的拖拽組件庫(kù)。

舊言 回答

我改項(xiàng)目路由了。。不用配置了。。

歆久 回答

同問,解決了嗎?我的組件文件html結(jié)構(gòu)比較多,文件比較大!每次保存熱更新,都要很久

嘟尛嘴 回答

使用字體圖標(biāo)更為合適,也更方便渲染。

安于心 回答

js里面寫的list對(duì)應(yīng)的jq對(duì)象,字符串和對(duì)象拼接會(huì)將對(duì)象轉(zhuǎn)為string類型,所以結(jié)果會(huì)和預(yù)期想的不一樣,改為如下

  var context = '',
        list = $('#content');
    for (var i = 0; i < 10; i++) {
        context += '<li><div id="content"><h1>標(biāo)題</h1><p><內(nèi)容></p></div></li>';
    }
    $("#app").append(context);
還吻 回答
    var sum = 0;
    setInterval(()=>{
        sum += Math.random()*10;
        console.log("和:", sum)
    },5000)
孤客 回答

心跳設(shè)置太長(zhǎng)了,這個(gè)配置應(yīng)該是最遲200秒才能觸發(fā)onClose。
$gateway->pingInterval =30;,這樣就可以30秒內(nèi)觸發(fā)onClose