feat: 使用 path 进行跳转

This commit is contained in:
xingyu4j
2025-10-20 15:42:23 +08:00
parent dd70dc0012
commit 03644613f3
5 changed files with 29 additions and 31 deletions

View File

@@ -16,56 +16,55 @@ const menuList = [
name: '用户管理',
icon: 'ep:user-filled',
bgColor: 'bg-red-400',
routerName: 'MemberUser',
routerPath: '/member/user',
},
{
name: '商品管理',
icon: 'fluent-mdl2:product',
bgColor: 'bg-orange-400',
routerName: 'ProductSpu',
routerPath: '/mall/product/spu',
},
{
name: '订单管理',
icon: 'ep:list',
bgColor: 'bg-yellow-500',
routerName: 'TradeOrder',
routerPath: '/mall/trade/order',
},
{
name: '售后管理',
icon: 'ri:refund-2-line',
bgColor: 'bg-green-600',
routerName: 'TradeAfterSale',
routerPath: '/mall/trade/after-sale',
},
{
name: '分销管理',
icon: 'fa-solid:project-diagram',
bgColor: 'bg-cyan-500',
routerName: 'TradeBrokerageUser',
routerPath: '/mall/trade/brokerage/brokerage-user',
},
{
name: '优惠券',
icon: 'ep:ticket',
bgColor: 'bg-blue-500',
routerName: 'PromotionCoupon',
routerPath: '/mall/promotion/coupon/template',
},
{
name: '拼团活动',
icon: 'fa:group',
bgColor: 'bg-purple-500',
routerName: 'PromotionBargainActivity',
routerPath: '/mall/promotion/combination/acitivity',
},
{
name: '佣金提现',
icon: 'vaadin:money-withdraw',
bgColor: 'bg-rose-500',
routerName: 'TradeBrokerageWithdraw',
routerPath: '/mall/trade/brokerage/brokerage-withdraw',
},
];
/** 跳转到菜单对应页面 */
// TODO @xingyu貌似通过 name 的方式,都无法跳转,找不到路由?
function handleMenuClick(routerName: string) {
router.push({ name: routerName });
function handleMenuClick(routerPath: string) {
router.push({ path: routerPath });
}
</script>
@@ -79,7 +78,7 @@ function handleMenuClick(routerName: 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.routerName)"
@click="handleMenuClick(menu.routerPath)"
>
<div
:class="menu.bgColor"