useShortcutBar.js
917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { useRoute } from 'vue-router';
import { ref } from 'vue';
import { Cookies } from '@/utils/generatePackage'
export const useShortcutBar = (item) => {
const $route = useRoute();
const path = $route.path;
const isClient = Cookies.get('userType') === 'client' ? true : false; // 判断C端入口位置,访客/客户
const case1 = ['home', 'me'];
const case2 = ['home'];
const case3 = ['me'];
const shortcutItem = ref([]);
// 配置快捷跳转条
if (item) {
shortcutItem.value = item;
} else {
if (path === '/client/chooseBook') { // 爱心捐书页面
if (isClient) {
shortcutItem.value = case1
} else {
shortcutItem.value = case3
}
}
if (path === '/client/donateCertificate') {
shortcutItem.value = case2
}
if (path === '/business/index') {
shortcutItem.value = case3
}
}
return {
shortcutItem
}
}