feat:使用 router name 进行跳转

This commit is contained in:
YunaiV
2025-10-20 19:14:00 +08:00
parent 2b15a1835d
commit fba34d6ceb
7 changed files with 49 additions and 89 deletions

View File

@@ -16,55 +16,55 @@ const menuList = [
name: '用户管理',
icon: 'ep:user-filled',
bgColor: 'bg-red-400',
routerPath: '/member/user',
routerName: 'MemberUser',
},
{
name: '商品管理',
icon: 'fluent-mdl2:product',
bgColor: 'bg-orange-400',
routerPath: '/mall/product/spu',
routerName: 'ProductSpu',
},
{
name: '订单管理',
icon: 'ep:list',
bgColor: 'bg-yellow-500',
routerPath: '/mall/trade/order',
routerName: 'TradeOrder',
},
{
name: '售后管理',
icon: 'ri:refund-2-line',
bgColor: 'bg-green-600',
routerPath: '/mall/trade/after-sale',
routerName: 'TradeAfterSale',
},
{
name: '分销管理',
icon: 'fa-solid:project-diagram',
bgColor: 'bg-cyan-500',
routerPath: '/mall/trade/brokerage/brokerage-user',
routerName: 'TradeBrokerageUser',
},
{
name: '优惠券',
icon: 'ep:ticket',
bgColor: 'bg-blue-500',
routerPath: '/mall/promotion/coupon/template',
routerName: 'PromotionCoupon',
},
{
name: '拼团活动',
icon: 'fa:group',
bgColor: 'bg-purple-500',
routerPath: '/mall/promotion/combination/acitivity',
routerName: 'PromotionBargainActivity',
},
{
name: '佣金提现',
icon: 'vaadin:money-withdraw',
bgColor: 'bg-rose-500',
routerPath: '/mall/trade/brokerage/brokerage-withdraw',
routerName: 'TradeBrokerageWithdraw',
},
];
/** 跳转到菜单对应页面 */
function handleMenuClick(routerPath: string) {
router.push({ path: routerPath });
function handleMenuClick(routerName: string) {
router.push({ name: routerName });
}
</script>
@@ -78,7 +78,7 @@ function handleMenuClick(routerPath: string) {
v-for="menu in menuList"
:key="menu.name"
class="flex h-20 w-[20%] cursor-pointer flex-col items-center justify-center gap-2"
@click="handleMenuClick(menu.routerPath)"
@click="handleMenuClick(menu.routerName)"
>
<div
:class="menu.bgColor"