多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
818 B

<script setup lang="ts">
import { saveAs } from 'file-saver'
const { t } = useI18n()
const { api } = useApi()
async function exportCache() {
try {
const data = await api.utils.cacheGet()
if (!data) {
// Cache is empty
message.info(t('msg.info.cacheEmpty'))
return
}
const blob = new Blob([JSON.stringify(data)], {
type: 'text/plain;charset=utf-8',
})
saveAs(blob, 'cache_exported.json')
// Exported Cache Successfully
message.info(t('msg.info.exportedCache'))
} catch (e: any) {
message.error(e.message)
}
}
</script>
<template>
<a-tooltip placement="bottom">
<template #title>
<span> Export Cache </span>
</template>
<component :is="iconMap.export" class="cursor-pointer" @click="exportCache" />
</a-tooltip>
</template>