 
                        前端js,post过去,频繁的点击,就很卡。
这是nodejs的代码:
    var express = require('express');
    var bodyParser = require("body-parser");
    var app = express();
    app.use(express.static('app'));
    app.use(bodyParser.urlencoded({ extended: false }));
    var server = app.listen(config.socket_port, function () {
      var host = server.address().address
      var port = server.address().port
      console.log("应用实例,访问地址为 http://%s:%s", host, port)
    })
    var post_callback = function (post_res, err, res){
        return post_res.end(JSON.stringify({err:err, res:res}));
    }
    app.post('/post', function(req, post_res) {
        let data = req.body;
        let filter = JSON.parse(data.filter);
        return post_callback(post_res, null, []);
    });这是前端的代码,jquery
$.post(configObj.socket_url+'post', {dbname: _this.dbname, action:_this.dbname+'__get', filter:JSON.stringify(filter)},function(res){
            let jsonObj = JSON.parse(res);
            console.log(jsonObj);
            callBack(jsonObj.err, jsonObj.res);
        });
仔细分析,我没发现哪里出现性能问题。我只是用鼠标快速的点几十下而已。页面就卡了。电脑都非常的卡。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
页面卡顿跟服务端没什么关系,再者实际应用中类似应用场景,都会做请求限制处理,避免连续无效点击