错误:无法在'Node'上执行'appendChild':在JavaScript中使用微调器时,参数1不是'Node'类型

问题描述 投票:0回答:1

我在https://spin.js.org/引用的javascript代码中实现了一个微调器,我收到一个错误 -

错误:无法在'Node'上执行'appendChild':参数1不是'Node'类型

码:

app.js

    render() {


    var opts = {
        lines: 13, // The number of lines to draw
        length: 38, // The length of each line
        width: 17, // The line thickness
        radius: 45, // The radius of the inner circle
        scale: 1, // Scales overall size of the spinner
        corners: 1, // Corner roundness (0..1)
        color: '#5229cc', // CSS color or array of colors
       //more
      };

       var target = document.getElementById('viz');
    //  var spinner = new Spinner(opts).spin(target);

        var spinner = new Spinner().spin();
        target.appendChild(spinner.el);


          //code
                },
                onCompleted: function () {
                    var target = document.getElementById('viz');
                    var spinner = new Spinner().stop();

                    target.appendChild(spinner.el);


                  session.close();
                 //code

        };
javascript spinner
1个回答
1
投票

可能你在onCompleted函数中得到错误。

我相信你应该删除target.appendChild(spinner.el);函数中的onCompleted

根据https://spin.js.org/

要隐藏微调器,请调用stop()方法,该方法从DOM中删除UI元素并停止动画。停止旋转器可以通过再次调用spin()来重用。

© www.soinside.com 2019 - 2024. All rights reserved.