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()