以下代码在IE 11中不起作用,它在控制台中引发语法错误 如何修复IE 11的代码?
function range(start, end) {
return Array.from(Array(end - start + 1), (_, i) => i + start);
}
&
getPageList(totalPages, currentPage, paginationSize).forEach( item => {
$("<li>").addClass("page-item")
.addClass(item ? "current-page" : "disabled")
.toggleClass("active", item === currentPage).append(
$("<a>").addClass("page-link").attr({
href: "javascript:void(0)"}).text(item || "...")
).insertBefore("#next-pages");
});
答案 0 :(得分:0)
function range(start, end) {
//return Array.from(Array(end - start + 1), (_, i) => i + start);
return Array.from(Array(end - start + 1), function(_, i) {return i + start });
}
&
getPageList(totalPages, currentPage, paginationSize).forEach(function(item) {
$("<li>").addClass("page-item")
.addClass(item ? "current-page" : "disabled")
.toggleClass("active", item === currentPage).append(
$("<a>").addClass("page-link").attr({
href: "javascript:void(0)"}).text(item || "...")
).insertBefore("#next-pages");
});