Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'报错问题

原因:
node_modules > iview > src > components > spin.js
Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'报错问题_第1张图片
remove (cb) {

spin.visible = false;
setTimeout(function() {
    spin.$parent.$destroy();
    //这个地方少了一个这个节点判断,导致removeChild 里面的节点不存在,加上判断即可
    if (document.getElementsByClassName('ivu-spin-fullscreen')[0]) {
        document.body.removeChild(document.getElementsByClassName('ivu-spin-fullscreen')[0]);
    }
    cb();
}, 500);

},
但是因为这个是源码,所以还同时需要修改打包后的文件:node_modules > iview > dist > iview.js

Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'报错问题_第2张图片
if (document.getElementsByClassName(‘ivu-spin-fullscreen’)[0]) {
document.body.removeChild(document.getElementsByClassName(‘ivu-spin-fullscreen’)[0]);
}

    即可修复,这个地方源码部分不是很严谨,没有加判断,导致在连续调用iview.Spin.hide()时会出问题,原因很简单给iview提issue,但是报错,

你可能感兴趣的:(Uncaught TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'报错问题)