javascript - 控制台不必要的错误消息是否会减慢网页速度?

标签 javascript html node.js handsontable

我正在使用 Handsontable 在我的网页中显示一些表格并且它工作正常,但是随着客户端离开页面挂起的时间,页面会累积错误,例如

(我无法上传图片,但消息是这样的)

387 handsontable.full.min.js:34 Uncaught TypeError: Cannot read property 'querySelector' of null
    at t.overlayContainsElement (handsontable.full.min.js:34)
    at n.value (handsontable.full.min.js:34)
    at n.value (handsontable.full.min.js:40)
    at n.value (handsontable.full.min.js:40)
    at HTMLDivElement.<anonymous> (handsontable.full.min.js:40)
    at HTMLDivElement.i (handsontable.full.min.js:34)

它是否导致页面变得比初始页面慢?

这是我的代码中的可操作部分


function table(data){
try {
    document.getElementById('data_view').innerHTML = null;
    const container = document.getElementById('data_view');
    hot = new Handsontable(container, {
    licenseKey: 'non-commercial-and-evaluation',
    data: data,
    //rowHeaders: true,
    colHeaders: 
 ['Area','WorkStation','Stepname','Commit','TechNode','Moves','WIP','Running','Hold','MTAS','Delta to Commit','Remarks','Delta to Commit'],
    //editor: false,
    columns: function(column) {
    var columnMeta = {};
    if (column === 0) {
      columnMeta.data = 'AreaName';
    } else if (column === 1) {
      columnMeta.data = 'workstation';
    } else if (column === 2) {
      columnMeta.data = 'Stepname';
    } else if (column === 3) {
      columnMeta.data = 'Commit';
    } else if (column === 4) {
      columnMeta.data = 'TechNode';
    } else if (column === 5) {
      columnMeta.data = 'Moves';
    } else if (column === 6) {
      columnMeta.data = 'Wip';
    } else if (column === 7) {
      columnMeta.data = 'Running';
    } else if (column === 8) {
      columnMeta.data = 'Hold';
    } else if (column === 9) {
      columnMeta.data = 'MTAS';     
    } else if (column === 10) {
      columnMeta.data = 'Delta to Commit';
    } else if (column === 11) {
      columnMeta.data = 'Remark';
      columnMeta.readOnly = false;
    }
    return columnMeta;
    },
    readOnly: false,
    overflow: 'hidden',
    contextMenu: true,
    afterSelection: function(r,c){
    selection = this.getDataAtRow(r);
    //localStorage.setItem("selection", selection);
    //sessionStorage.setItem("selection2", selection);
    //onsole.log(data)
    },
    contextMenu: {
    items: {
        'row_above': {},
        'row_below': {},
        'col_left': {},
        'col_right': {},
        'remove_row': {},
        'remove_col': {},
        'undo': {},
        'redo': {},
        'make_read_only': {},
        'alignment': {},
        'copy': {},
        'export': {
            name: 'Export to CSV',
            callback: function(key, options) {
            hot.getPlugin('exportFile').downloadFile('csv', {
            columnHeaders: true,
            overflow: 'hidden',
            filename: 'Commit_Download_' + JSON.stringify(sqlrefresh[0].last_refresh)
            })}
        },
        'lot_id_list': {
          name: 'Check Lot',
          callback: function() {
window.open("http://mfgrpa2:4000/lot_list?"+"Step="+selection[2].toString()+"Technode="+selection[4].toString(), "lot_list", "width=1500");
          }
        }
    }},
    dropdownMenu: true,
    filters: true,
    manualColumnResize: true,
    manualRowResize: true,
    columnSorting: true,
    formulas: true,
    minRows: 2,
    minCols: 12,
    minSpareRows: 1,
    //maxCols: 3,
    //colWidths: '100',
    //height: 320,
    //afterGetColHeader: addInput,
    cells: function (row, col) {
    var cellProperties = {};
    const cellValue = this.instance.getDataAtCell(row, col);
    if (col === 10){
        if ( cellValue > 0 ) {
          cellProperties.renderer = function (instance, td, row, col, prop, value, cellProperties) {
              Handsontable.renderers.TextRenderer.apply(this, arguments);
              td.style.fontWeight = 'bold';
              td.style.color = 'black';
              td.style.background = '#4FF635';
          }
        }
        else if ( cellValue < 0 ) {
          cellProperties.renderer = function (instance, td, row, col, prop, value, cellProperties) {
              Handsontable.renderers.TextRenderer.apply(this, arguments);
              td.style.fontWeight = 'bold';
              td.style.color = 'black';
              td.style.background = '#C84321';
          }
        }
        else {
        }
    }
    return cellProperties;
    }
    });
    }
    catch(e){
    }}

谢谢。

最佳答案

通常这对站点的性能来说不是问题,只是它不美观或不专业。您应该尝试修复错误或寻找其他解决方案。

关于javascript - 控制台不必要的错误消息是否会减慢网页速度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66349717/

相关文章:

javascript - boolean 变量没有声明?

html - Youtube 嵌入式视频 z-index

mysql - contains 和 contained in sequelize Where 子句有什么用?

javascript - nodejs keydown/keyup 事件

node.js - 如何在 Centos 7 中清除 Node.js 终端

javascript - Knockoutjs 单选按钮组自定义绑定(bind)未根据选择更新

javascript - 通过具有部分透明背景的元素触发事件

c# - ASP.NET javascript 参数为 null

javascript - 如何让我的导航面板根据事件页面更改颜色?

javascript - 多个耗时计数器