Files
continew-admin-ui/src/views/dashboard/workplace/components/recently-visited.vue
Charles7c b56f029e68 refactor: 引入 unplugin-auto-import,减少重复性 Vue 函数引入
避免在每个 Vue 组件中都重复性的去声明 ref 等函数
2024-01-07 23:54:43 +08:00

54 lines
1.3 KiB
Vue

<template>
<a-card
class="general-card"
:title="$t('workplace.recently.visited')"
:header-style="{ paddingBottom: '0' }"
:body-style="{ paddingTop: '26px' }"
>
<div style="margin-bottom: -1rem">
<a-row :gutter="8">
<a-col
v-for="link in links"
:key="link.title"
:span="8"
class="wrapper"
>
<div @click="router.replace({ path: link.path })">
<div class="icon">
<svg-icon :icon-class="link.icon" />
</div>
<a-typography-paragraph class="text">
{{ link.title }}
</a-typography-paragraph>
</div>
</a-col>
</a-row>
</div>
</a-card>
</template>
<script lang="ts" setup>
import { DashboardRecentlyVisitedRecord } from '@/api/common/dashboard';
const router = useRouter();
const links = ref<DashboardRecentlyVisitedRecord[]>();
/**
* 加载最近访问菜单列表
*/
onMounted(() => {
const recentlyVisitedList = window.localStorage.getItem('recently-visited');
if (recentlyVisitedList === null) {
links.value = [];
} else {
links.value = JSON.parse(recentlyVisitedList);
}
});
</script>
<style lang="less" scoped>
:deep(.arco-card-header-title) {
line-height: inherit;
}
</style>