mirror of
https://github.com/fantastic-admin/basic.git
synced 2026-10-07 14:57:52 +08:00
控制语句代码风格调整
This commit is contained in:
@@ -5,11 +5,12 @@ export default function useAuth() {
|
||||
function hasPermission(permission: string) {
|
||||
const settingsStore = useSettingsStore()
|
||||
const userStore = useUserStore()
|
||||
if (settingsStore.app.enablePermission)
|
||||
if (settingsStore.app.enablePermission) {
|
||||
return userStore.permissions.includes(permission)
|
||||
|
||||
else
|
||||
}
|
||||
else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
function auth(value: string | string[]) {
|
||||
|
||||
@@ -10,11 +10,12 @@ export default function useMenu() {
|
||||
function switchTo(index: number | string) {
|
||||
menuStore.setActived(index)
|
||||
if (settingsStore.menu.switchMainMenuAndPageJump) {
|
||||
if (isExternalLink(menuStore.sidebarMenusFirstDeepestPath))
|
||||
if (isExternalLink(menuStore.sidebarMenusFirstDeepestPath)) {
|
||||
window.open(menuStore.sidebarMenusFirstDeepestPath, '_blank')
|
||||
|
||||
else
|
||||
}
|
||||
else {
|
||||
router.push(menuStore.sidebarMenusFirstDeepestPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,16 @@ export default function directive(app: App) {
|
||||
// 注册 v-auth 和 v-auth-all 指令
|
||||
app.directive('auth', {
|
||||
mounted: (el, binding) => {
|
||||
if (!useAuth().auth(binding.value))
|
||||
if (!useAuth().auth(binding.value)) {
|
||||
el.remove()
|
||||
}
|
||||
},
|
||||
})
|
||||
app.directive('auth-all', {
|
||||
mounted: (el, binding) => {
|
||||
if (!useAuth().authAll(binding.value))
|
||||
if (!useAuth().authAll(binding.value)) {
|
||||
el.remove()
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
+4
-4
@@ -5,11 +5,11 @@ export function isExternalLink(path: string) {
|
||||
}
|
||||
|
||||
export function resolveRoutePath(basePath: string, routePath: string) {
|
||||
if (isExternalLink(routePath))
|
||||
if (isExternalLink(routePath)) {
|
||||
return routePath
|
||||
|
||||
if (isExternalLink(basePath))
|
||||
}
|
||||
if (isExternalLink(basePath)) {
|
||||
return basePath
|
||||
|
||||
}
|
||||
return basePath ? path.resolve(basePath, routePath) : routePath
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user