gpt4 book ai didi

javascript - 错误: Failed to execute 'appendChild' on 'Node' : parameter 1 is not of type 'Node' while using a spinner in JavaScript

转载 作者:行者123 更新时间:2023-12-03 00:08:23 24 4
gpt4 key购买 nike

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

Error: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type '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

};

最佳答案

您可能在 onCompleted 函数中收到错误。

我认为您应该删除 onCompleted 函数中的 target.appendChild(spinner.el);

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

To hide the spinner, invoke the stop() method, which removes the UI elements from the DOM and stops the animation. Stopped spinners may be reused by calling spin() again.

关于javascript - 错误: Failed to execute 'appendChild' on 'Node' : parameter 1 is not of type 'Node' while using a spinner in JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54861427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com