mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-11-15 14:03:36 +08:00
style: format code for all
This commit is contained in:
@@ -5,48 +5,47 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed, defineComponent, unref } from "vue"
|
||||
import { isUrl } from "/@/utils/is.ts"
|
||||
import { computed, defineComponent, unref } from "vue";
|
||||
import { isUrl } from "/@/utils/is.ts";
|
||||
|
||||
export default defineComponent({
|
||||
name: "Link",
|
||||
props: {
|
||||
to: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
required: true
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
|
||||
const isExternal = computed(() => {
|
||||
return isUrl(props.to)
|
||||
})
|
||||
return isUrl(props.to);
|
||||
});
|
||||
|
||||
const type = computed(() => {
|
||||
if (unref(isExternal)) {
|
||||
return 'a'
|
||||
return "a";
|
||||
}
|
||||
return 'router-link'
|
||||
})
|
||||
return "router-link";
|
||||
});
|
||||
|
||||
function linkProps(to) {
|
||||
if (unref(isExternal)) {
|
||||
return {
|
||||
href: to,
|
||||
target: '_blank',
|
||||
rel: 'noopener'
|
||||
}
|
||||
target: "_blank",
|
||||
rel: "noopener"
|
||||
};
|
||||
}
|
||||
return {
|
||||
to: to
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
isExternal,
|
||||
type,
|
||||
linkProps,
|
||||
}
|
||||
},
|
||||
linkProps
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
|
||||
<div class="sidebar-logo-container" :class="{ collapse: collapse }">
|
||||
<transition name="sidebarLogoFade">
|
||||
<router-link
|
||||
v-if="collapse"
|
||||
@@ -11,7 +11,13 @@
|
||||
<i class="fa fa-optin-monster"></i>
|
||||
<h1 class="sidebar-title">{{ settings.title }}</h1>
|
||||
</router-link>
|
||||
<router-link v-else key="expand" :title="settings.title" class="sidebar-logo-link" to="/">
|
||||
<router-link
|
||||
v-else
|
||||
key="expand"
|
||||
:title="settings.title"
|
||||
class="sidebar-logo-link"
|
||||
to="/"
|
||||
>
|
||||
<i class="fa fa-optin-monster"></i>
|
||||
<h1 class="sidebar-title">{{ settings.title }}</h1>
|
||||
</router-link>
|
||||
|
||||
@@ -20,7 +20,12 @@
|
||||
</app-link>
|
||||
</template>
|
||||
|
||||
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
|
||||
<el-submenu
|
||||
v-else
|
||||
ref="subMenu"
|
||||
:index="resolvePath(item.path)"
|
||||
popper-append-to-body
|
||||
>
|
||||
<template #title>
|
||||
<i :class="item.meta.icon"></i>
|
||||
<span>{{ $t(item.meta.title) }}</span>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="{'has-logo': showLogo}">
|
||||
<div :class="{ 'has-logo': showLogo }">
|
||||
<Logo v-if="showLogo === '1'" :collapse="isCollapse" />
|
||||
<el-scrollbar wrap-class="scrollbar-wrapper">
|
||||
<el-menu
|
||||
@@ -22,18 +22,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {
|
||||
computed,
|
||||
defineComponent,
|
||||
ref,
|
||||
unref,
|
||||
nextTick,
|
||||
onBeforeMount
|
||||
} from "vue";
|
||||
import { computed, defineComponent, ref, onBeforeMount } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useAppStoreHook } from "/@/store/modules/app";
|
||||
import SidebarItem from "./SidebarItem.vue";
|
||||
import { algorithm } from "../../../utils/algorithm";
|
||||
import { algorithm } from "/@/utils/algorithm";
|
||||
import { emitter } from "/@/utils/mitt";
|
||||
import Logo from "./Logo.vue";
|
||||
import { storageLocal } from "/@/utils/storage";
|
||||
@@ -69,7 +62,7 @@ export default defineComponent({
|
||||
}
|
||||
// 找到当前路由的信息
|
||||
function findCurrentRoute(routes) {
|
||||
return routes.map((item, key) => {
|
||||
return routes.map(item => {
|
||||
if (item.path === indexPath) {
|
||||
// 切换左侧菜单 通知标签页
|
||||
emitter.emit("changLayoutRoute", {
|
||||
@@ -80,7 +73,6 @@ export default defineComponent({
|
||||
if (item.children) findCurrentRoute(item.children);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
findCurrentRoute(algorithm.increaseIndexes(router));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user