我已经为 apexchart.js 使用了 blazor 包装器来构建图表组件。这是我的 ApexChart 剃须刀组件。
<BLChartContainer>
@if (chartDetails!=null)
{
<ApexChart @ref=_detailsChart TItem="LocationViseStockResponse"
Title="Stocks"
OnDataPointSelection=DataPointsSelected
Debug>
<ApexPointSeries TItem="LocationViseStockResponse"
Items="chartDetails"
Name=""
SeriesType="SeriesType.Bar"
XValue="@(e => e.Location.CodeName)"
YValue="@(e => e.Qty)"
OrderByDescending="e=>e.X" />
</ApexChart>
}
</BLChartContainer>
@code{
private ApexChart<LocationViseStockResponse> _detailsChart;
private SelectedData<LocationViseStockResponse> selectedData;
private IList<LocationViseStockResponse> chartDetails;
protected override async Task OnInitializedAsync()
{
_detailsChart = new();
chartDetails= new List<LocationViseStockResponse>();
//..
}
private void DataPointsSelected(SelectedData<LocationViseStockResponse> selectedData)
{
this.selectedData = selectedData;
_detailsChart?.SetRerenderChart();
}
}
但是当我运行应用程序时,我收到了这个控制台错误。
暴击:Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] 未处理的异常渲染组件:找不到“blazor_apexchart.renderChart”(“blazor_apexchart”未定义)。错误:找不到“blazor_apexchart.renderChart”(“blazor_apexchart”未定义)。在 https://localhost:5050/_framework/blazor.webassembly.js:1:328 在 Array.forEach () 在 a.findFunction (https://localhost:5050/_framework/blazor.webassembly.js:1:296 ) at _ (https://localhost:5050/_framework/blazor.webassembly.js:1:2437) at https://localhost:5050/_framework/blazor.webassembly.js:1:3325 at new Promise () at Object.beginInvokeJSFromDotNet (https://localhost:5050/_framework/blazor.webassembly.js:1:3306) 在 Object.Rt [as invokeJSFromDotNet] (https://localhost:5050/_framework/blazor.webassembly.js:1 :
确切的问题是什么?请帮助我,感谢您的所有帮助