yanjinhui
5 天以前 d3091b37a593885877f4ed4180d49e5ce259b657
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { useI18n } from '@/hooks/web/useI18n'
import router from '@/router'
 
export const hasPermi = (value: string) => {
  const { t } = useI18n()
  const permission = (router.currentRoute.value.meta.permission || []) as string[]
  if (!value) {
    throw new Error(t('permission.hasPermission'))
  }
  if (permission.includes(value)) {
    return true
  }
  return false
}