feat(admin): 添加管理员面板路由跳转功能

- 引入 vue-router 的 useRouter 钩子
- 在组件中初始化路由器实例
- 为最新用户卡片添加路由跳转功能
- 为最新音乐卡片添加路由跳转功能
- 点击查看更多按钮可跳转到对应管理页面
This commit is contained in:
ikmkj
2026-03-10 23:15:53 +08:00
parent f27a4cc7ec
commit efccff567a

View File

@@ -1,5 +1,6 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElLoading, ElMessage } from 'element-plus'
import * as echarts from 'echarts/core'
import { BarChart, LineChart, PieChart } from 'echarts/charts'
@@ -57,6 +58,9 @@ const userGrowthData = ref([])
const musicTypeData = ref([])
const playCountData = ref([])
// 路由
const router = useRouter()
// 加载状态
const loading = ref(false)
@@ -484,7 +488,7 @@ onUnmounted(() => {
<template #header>
<div class="card-header">
<span>最新用户</span>
<el-button text>查看更多</el-button>
<el-button text @click="router.push({ name: 'admin-user' })">查看更多</el-button>
</div>
</template>
@@ -501,7 +505,7 @@ onUnmounted(() => {
<template #header>
<div class="card-header">
<span>最新音乐</span>
<el-button text>查看更多</el-button>
<el-button text @click="router.push({ name: 'admin-music' })">查看更多</el-button>
</div>
</template>