更新时间:2023-10-11 22:48:04
在使用预渲染时,它被调用了两次.转到_Host.cshtml
并将render-mode="ServerPrerendered"
更改为render-mode="Server"
,它将仅被调用一次:
It is called twice, as you are using pre-rendering. Go to _Host.cshtml
and change render-mode="ServerPrerendered"
to render-mode="Server"
, and it would be called only once:
<app>
<component type="typeof(App)" render-mode="Server" />
</app>
参考: