Javascript jquery.simplePagination.js:334未捕获类型错误:无法设置属性';当前页面';空的

Javascript jquery.simplePagination.js:334未捕获类型错误:无法设置属性';当前页面';空的,javascript,jquery,foreach,Javascript,Jquery,Foreach,您好,我在我的浏览器中遇到了这个错误,函数以INTERTEND的形式工作。我只是想知道为什么我会遇到这个错误,我可以看出这是因为它将currentPage值设置为null,但我不明白为什么会出现这个问题。寻呼工作正常,我只是想知道我是否能解决这个错误。我是新手 jquery.simplePagination.js:334 Uncaught TypeError: Cannot set property 'currentPage' of null at init._selectPage (j

您好,我在我的浏览器中遇到了这个错误,函数以INTERTEND的形式工作。我只是想知道为什么我会遇到这个错误,我可以看出这是因为它将currentPage值设置为null,但我不明白为什么会出现这个问题。寻呼工作正常,我只是想知道我是否能解决这个错误。我是新手

jquery.simplePagination.js:334 Uncaught TypeError: Cannot set property 'currentPage' of null
    at init._selectPage (jquery.simplePagination.js:334)
    at init.selectPage (jquery.simplePagination.js:66)
    at init.$.fn.pagination (jquery.simplePagination.js:389)
    at checkFragment (Blog:440)
    at HTMLDocument.<anonymous> (Blog:447)
    at c (jquery.min.js:4)
    at Object.fireWith [as resolveWith] (jquery.min.js:4)
    at Function.ready (jquery.min.js:4)
    at HTMLDocument.q (jquery.min.js:4)
jquery.simplePagination.js:334未捕获类型错误:无法将属性“currentPage”设置为null
在init.\u selectPage(jquery.simplePagination.js:334)
在init.selectPage(jquery.simplePagination.js:66)
在初始化时$.fn.pagination(jquery.simplePagination.js:389)
在checkFragment(博客:440)
在HTMLDocument

如果有人对foreach分页函数有更好的解决方案,请告诉我

<script src="~/Scripts/jquery.simplePagination.js"></script>
<script>
         // mind the slight change below, personal idea of best practices
         jQuery(function ($) {
             // consider adding an id to your table,
             // just incase a second table ever enters the picture..?
             var items = $("article");

             var numItems = items.length;
             var perPage = 2;

             // only show the first 2 (or "first per_page") items initially
             items.slice(perPage).hide();

             // now setup your pagination
             // you need that .pagination-page div before/after your table
             if (numItems > 2) {
                 $(".pagination-page").pagination({
                     items: numItems,
                     itemsOnPage: perPage,
                     cssStyle: "light-theme",
                     onPageClick: function (pageNumber) { // this is where the magic happens
                         // someone changed page, lets hide/show trs appropriately
                         var showFrom = perPage * (pageNumber - 1);
                         var showTo = showFrom + perPage;

                         items.hide() // first hide everything, then show for the new page
                             .slice(showFrom, showTo).show();
                     }
                 });
             }


             // EDIT: extra stuff to cover url fragments (i.e. #page-3)
             // https://github.com/bilalakil/bin/tree/master/simplepagination/page-fragment
             // is more thoroughly commented (to explain the regular expression)

             // we'll create a function to check the url fragment and change page
             // we're storing this function in a variable so we can reuse it
             var checkFragment = function () {
                 // if there's no hash, make sure we go to page 1
                 var hash = window.location.hash || "#page-1";

                 // we'll use regex to check the hash string
                 hash = hash.match(/^#page-(\d+)$/);

                 if (hash)
                     // the selectPage function is described in the documentation
                     // we've captured the page number in a regex group: (\d+)
                     $("#pagination").pagination("selectPage", parseInt(hash[1]));
             };

             // we'll call this function whenever the back/forward is pressed
             $(window).bind("popstate", checkFragment);

             // and we'll also call it to check right now!
             checkFragment();



         });
</script>