From 6f68732ef9b6d25828d78f325aac05ad22e8f9e7 Mon Sep 17 00:00:00 2001 From: Allen Date: Fri, 5 Apr 2024 04:11:50 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BD=8E=E7=89=88=E6=9C=AC=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E6=95=B0=E7=BB=84=E4=B8=8D=E6=94=AF=E6=8C=81at?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@core/utils/compatibility.ts | 18 ++++++++++++++++++ src/views/reorganize/TransferHistoryView.vue | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 src/@core/utils/compatibility.ts diff --git a/src/@core/utils/compatibility.ts b/src/@core/utils/compatibility.ts new file mode 100644 index 00000000..6333fa74 --- /dev/null +++ b/src/@core/utils/compatibility.ts @@ -0,0 +1,18 @@ +/** + * 浏览器兼容性处理 + */ + +/** + * 修复低版本Safari等浏览器数组不支持at函数的问题 + */ +export function fixArrayAt() { + if (!Array.prototype.at) { + Array.prototype.at = function(index: number) { + if (index >= 0) { + return this[index] + } else { + return this[this.length + index] + } + } + } +} diff --git a/src/views/reorganize/TransferHistoryView.vue b/src/views/reorganize/TransferHistoryView.vue index fc2c339e..a5824c83 100644 --- a/src/views/reorganize/TransferHistoryView.vue +++ b/src/views/reorganize/TransferHistoryView.vue @@ -4,6 +4,7 @@ import { useToast } from 'vue-toast-notification' import api from '@/api' import type { TransferHistory } from '@/api/types' import ReorganizeForm from '@/components/form/ReorganizeForm.vue' +import { fixArrayAt } from '@/@core/utils/compatibility' // 提示框 const $toast = useToast() @@ -304,6 +305,9 @@ const dropdownItems = ref([ }, }, ]) + +// 修复低版本Safari等浏览器数组不支持at函数的问题 +fixArrayAt()