关于这个分页插件: http ://beneverard.github.io/jqPagination
$('.pagination').jqPagination('option', 'current_page')
应该“获取”当前页面。但是它返回值“假”
$('.pagination').jqPagination('option', 'current_page', 4)
应该将当前页面“设置”为 4。它确实如此。
我在这里做错了什么还是“getter”代码中有错误?
关于这个分页插件: http ://beneverard.github.io/jqPagination
$('.pagination').jqPagination('option', 'current_page')
应该“获取”当前页面。但是它返回值“假”
$('.pagination').jqPagination('option', 'current_page', 4)
应该将当前页面“设置”为 4。它确实如此。
我在这里做错了什么还是“getter”代码中有错误?
在 github 上的问题列表中找到答案:https ://github.com/beneverard/jqPagination/issues/26
希望下个版本能解决:
BOAndrew 4 个月前发表评论 Hi Ben,首先感谢您的贡献。我还使用了您的分页插件,并在获取值时遇到了这个问题。解决方案很简单:
只需在第 310 行之后添加以下行(函数 'callMethod', switch, case 'option')
base.callMethod = function (method, key, value) {
switch (method.toLowerCase()) {
case 'option': // line 310
//added code
if (value === undefined) {
return base.options[key];
}
// end of added code
这不会检查请求的值是否实际上是“选项”对象的一部分,因此它可以返回未定义但同时代码保持灵活(以防您以后想添加更多选项)。