我正在try 使用dotNetHelper将图表中的所有系列从JS传递到CS. 但在此行中出现错误("window.dotNetHelper.invokeMethodAsync(‘Items’,allSeries)".我try 了其他堆栈溢出答案中建议的不同方法,但无法使其正常工作.将非常感谢您的意见.
错误:
blazor.webassembly.js:1 Uncaught (in promise) Type错误: Converting circular structure to JSON
--> starting at object with constructor 'u'
| property 'alignedObjects' -> object with constructor 'Array'
| index 0 -> object with constructor 'z'
--- property 'renderer' closes the circle
at JSON.stringify (<anonymous>)
at k (blazor.webassembly.js:1:5176)
at b (blazor.webassembly.js:1:1989)
at A.invokeMethodAsync (blazor.webassembly.js:1:3866)
at v.itemEvent (JSInterop.min.js:269:23)
at highstock.js:17:483
at Array.forEach (<anonymous>)
at f (highstock.js:17:461)
at v.firePointEvent (highstock.js:270:1)
at C.runPointActions (highstock.js:307:340)
Jsteredop.js:
function itemEvent() {
const allSeries = this.series.chart.series;
//const convert = JSON.parse(JSON.stringify(allSeries))
window.dotNetHelper.invokeMethodAsync('Items', allSeries); // Error in this line
}
加入时间:清华2007年01月25日下午3:33
[JSInvokable]
public void Items(List<Items> allseries)
{
Console.WriteLine("Enter");// does not enter here
foreach (var eachItem in allseries)
{
Console.WriteLine("eachItem {0}", eachItem);
}
}