有没有办法在视图中导入剃刀内联助手?
我尝试了以下方法:
<% Html.Partial("PaginationTemplate"); %>
<!-- later down -->
<%= KnockoutPagination("pendingQuestionsPagination", "$root.pendingQuestionsViewModel.pagination") %>
在 PaginationTemplate.cshtml 里面...
@helper KnockoutPagination(string id, string context) {
<div id="@id" class="pagination pagination-centered" data-bind="with: @context, visible: @(context).hasPages">
<ul>
<li data-bind="css: prevCss"><a href="#" data-bind="click: clickPrev">Prev</a></li>
<!-- ko foreach: pages -->
<li data-bind="css: $parent.pagingItemCss($data)"><a href="#" data-bind="text: $data, click: $parent.changePage"></a></li>
<!-- /ko -->
<li data-bind="css: nextCss"><a href="#" data-bind="click: clickNext">Next</a></li>
</ul>
</div>
}