解决 pdf.js 出现 TypeError: key.split(...).at is not a function 报错问题

问题

使用pdf.js v2版本部分机型出现 TypeError: key.split(...).at is not a function 报错

解决

参考 https://github.com/wojtekmaj/react-pdf/issues/1465

方式一(推荐)
javascript 复制代码
 import 'core-js/features/array/at';
方式二 (解决了部分机型浏览器问题)
javascript 复制代码
  if (!Array.prototype.at) {
    Array.prototype.at = function (index) {
      if (index < 0) {
        index = this.length + index;
      }
      if (index >= 0 && index < this.length) {
        return this[index];
      }
      return undefined;
    };
  }
相关推荐
不羁的fang少年9 分钟前
前端常见问题(vue,css,html,js等)
前端·javascript·css
change_fate15 分钟前
el-menu折叠后文字下移
前端·javascript·vue.js
yivifu18 分钟前
CSS Grid 布局详解(2025最新标准)
前端·css
o***Z4482 小时前
前端性能优化案例
前端
张拭心2 小时前
前端没有实际的必要了?结合今年工作内容,谈谈我的看法
前端·ai编程
姜太小白2 小时前
【前端】CSS媒体查询响应式设计详解:@media (max-width: 600px) {……}
前端·css·媒体
weixin_411191842 小时前
flutter中WebView的使用及JavaScript桥接的问题记录
javascript·flutter
HIT_Weston2 小时前
39、【Ubuntu】【远程开发】拉出内网 Web 服务:构建静态网页(二)
linux·前端·ubuntu
百***06012 小时前
SpringMVC 请求参数接收
前端·javascript·算法
天外天-亮2 小时前
Vue + excel下载 + 水印
前端·vue.js·excel