zhitong.yu
8 天以前 378d781e6f35f89652aa36e079a8b7fc44cea77e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { computed } from "vue";
 
import { useAuthStore } from "@/stores/modules/auth"; // 根据实际情况修改导入路径
 
export const useAuthButtons = () => {
  // 原本获取当前路由信息的代码保留,但后续不再使用
  // const route = useRoute();
  const authStore = useAuthStore();
 
  // 获取 authButtonListGet 对象中的所有值,并将它们合并成一个数组
  const allAuthButtons = Object.values(authStore.authButtonListGet).flat();
 
  const BUTTONS = computed(() => {
    let currentPageAuthButton = {};
    allAuthButtons.forEach(item => (currentPageAuthButton[item] = true));
    return currentPageAuthButton;
  });
 
  return {
    BUTTONS
  };
};