在pages文件夹中,我在index.cshtml页面中想要调入其他的带数据模型的Razor页面应如何操作。
代码如下:
<div class="col-md-3">
<h2>测试系列1</h2>
@*@await Html.PartialAsync("ceshi")*@
@await Component.InvokeAsync("ceshi2")
</div>
<div class="col-md-3">
<h2>测试系列2</h2>
@*<ul>
<li><a href="https://go.microsoft.com/fwlink/?linkid=852130">Working with Razor Pages.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
</ul>*@
</div>

具体如图:
当我用Html.PartialAsync时,页面提示我“InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'qtysh.Pages.IndexModel', but this ViewDataDictionary instance requires a model item of type 'qtysh.Pages.ceshiModel'.”
当我用@await Component.InvokeAsync("ceshi")时,页面提示我“InvalidOperationException: A view component named 'ceshi2' could not be found. A view component must be a public non-abstract class, not contain any generic parameters, and either be decorated with
'ViewComponentAttribute' or have a class name ending with the 'ViewComponent' suffix. A view component must not be decorated with 'NonViewComponentAttribute'.”
现在的问题是:我在index.cshtml中调用ceshi.cshtml页面,是否可行,如果可行应该用什么方法,具体如何实现?微软官方推荐的方法机制是什么?有相关的资料有吗?