feat(admin): 添加管理员面板路由跳转功能
- 引入 vue-router 的 useRouter 钩子 - 在组件中初始化路由器实例 - 为最新用户卡片添加路由跳转功能 - 为最新音乐卡片添加路由跳转功能 - 点击查看更多按钮可跳转到对应管理页面
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted } from 'vue'
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
import { ElLoading, ElMessage } from 'element-plus'
|
import { ElLoading, ElMessage } from 'element-plus'
|
||||||
import * as echarts from 'echarts/core'
|
import * as echarts from 'echarts/core'
|
||||||
import { BarChart, LineChart, PieChart } from 'echarts/charts'
|
import { BarChart, LineChart, PieChart } from 'echarts/charts'
|
||||||
@@ -57,6 +58,9 @@ const userGrowthData = ref([])
|
|||||||
const musicTypeData = ref([])
|
const musicTypeData = ref([])
|
||||||
const playCountData = ref([])
|
const playCountData = ref([])
|
||||||
|
|
||||||
|
// 路由
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
// 加载状态
|
// 加载状态
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@@ -484,7 +488,7 @@ onUnmounted(() => {
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>最新用户</span>
|
<span>最新用户</span>
|
||||||
<el-button text>查看更多</el-button>
|
<el-button text @click="router.push({ name: 'admin-user' })">查看更多</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -501,7 +505,7 @@ onUnmounted(() => {
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>最新音乐</span>
|
<span>最新音乐</span>
|
||||||
<el-button text>查看更多</el-button>
|
<el-button text @click="router.push({ name: 'admin-music' })">查看更多</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user