added match pattern
This commit is contained in:
@@ -27,9 +27,18 @@ const profileLinks = ref([
|
||||
icon: "bi:ticket",
|
||||
title: "تیکت ها",
|
||||
path: { name: "profile-tickets" },
|
||||
matchPattern: /^profile-ticket/,
|
||||
},
|
||||
]);
|
||||
|
||||
const isLinkActive = (link: any) => {
|
||||
if (link.matchPattern) {
|
||||
return link.matchPattern.test(route.name);
|
||||
} else {
|
||||
return route.name === link.path.name;
|
||||
}
|
||||
};
|
||||
|
||||
// queries
|
||||
|
||||
const { data: account, suspense } = useGetAccount();
|
||||
@@ -66,9 +75,9 @@ await suspense();
|
||||
:key="index"
|
||||
:to="{ ...link.path }"
|
||||
:class="
|
||||
route.name == link.path.name
|
||||
? 'bg-black text-slate-100 **:fill-slate-100 '
|
||||
: '**:fill-black '
|
||||
isLinkActive(link)
|
||||
? 'bg-black text-slate-100 **:fill-slate-100'
|
||||
: '**:fill-black'
|
||||
"
|
||||
class="flex items-center justify-between transition-all rounded-lg py-4 px-3"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user