UNPKG

@_lan/web-libs

Version:

<div align="center"> <img src="./public/favicon.svg" width="160" /> <h1>SoybeanAdmin AntDesign</h1> <span>中文 | <a href="./README.en_US.md">English</a></span> </div>

22 lines (16 loc) 433 B
import { useAuthStore } from '@/store/modules/auth'; export function useAuth() { const authStore = useAuthStore(); function hasAuth(codes: string | string[]) { if (!authStore.isLogin) { return false; } if (typeof codes === 'string') { return authStore.userInfo.buttons.includes(codes); } return codes.some(code => authStore.userInfo.buttons.includes(code)); } return { hasAuth }; }