style(components): 优化了一些和布局相关的组件样式

This commit is contained in:
‘chen.home’ 2022-08-18 21:49:12 +08:00
parent b2a9425a45
commit 6ed4a16291
10 changed files with 28 additions and 11 deletions

View File

@ -27,7 +27,7 @@ export function useAppRouter(isSetup = true) {
/* 跳转根页方法 */ /* 跳转根页方法 */
function toRoot() { function toRoot() {
routerPush({ name: 'root' }); routerPush({ name: 'appRoot' });
} }
/* 跳转至登录页 */ /* 跳转至登录页 */
function toLogin(redirectUrl?: string) { function toLogin(redirectUrl?: string) {

View File

@ -21,6 +21,7 @@
<UserCenter /> <UserCenter />
</div> </div>
</n-layout-header> </n-layout-header>
<n-layout-header bordered class="h-40px"><TabBar /></n-layout-header>
<div class="p-16px"> <div class="p-16px">
<n-layout-content> <n-layout-content>
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
@ -52,6 +53,7 @@ import {
UserCenter, UserCenter,
Search, Search,
Reload, Reload,
TabBar,
} from '../components'; } from '../components';
const appStore = useAppStore(); const appStore = useAppStore();

View File

@ -1,7 +1,7 @@
<template> <template>
<n-space <n-space
align="center" align="center"
class="hover:bg-hex-F3F4F6 hover:shadow-inner h-full px-3 cursor-pointer transition duration-300" class="hover:bg-hex-F3F4F6 hover:shadow-inner h-full px-3 cursor-pointer transition duration-300 dark:bg-hex-f90"
> >
<slot /> <slot />
</n-space> </n-space>

View File

@ -2,7 +2,7 @@
<n-tooltip placement="bottom" trigger="hover"> <n-tooltip placement="bottom" trigger="hover">
<template #trigger> <template #trigger>
<HeaderButton @click="handleReload"> <HeaderButton @click="handleReload">
<i-icon-park-outline-refresh class="text-18px" /> <i-icon-park-outline-refresh class="text-18px" :class="{ 'animate-spin': loading }" />
</HeaderButton> </HeaderButton>
</template> </template>
<span>刷新页面</span> <span>刷新页面</span>
@ -12,10 +12,17 @@
<script setup lang="ts"> <script setup lang="ts">
import HeaderButton from '../common/HeaderButton.vue'; import HeaderButton from '../common/HeaderButton.vue';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import { ref } from 'vue';
const appStore = useAppStore(); const appStore = useAppStore();
const loading = ref(false);
const handleReload = () => { const handleReload = () => {
loading.value = true;
appStore.reloadPage(); appStore.reloadPage();
setTimeout(() => {
loading.value = false;
}, 800);
}; };
</script> </script>

View File

@ -14,6 +14,9 @@ import UserCenter from './header/UserCenter.vue';
import Search from './header/Search.vue'; import Search from './header/Search.vue';
import Reload from './header/Reload.vue'; import Reload from './header/Reload.vue';
/* 标签栏组件 */
import TabBar from './tab/TabBar.vue';
export { export {
Breadcrumb, Breadcrumb,
CollapaseButton, CollapaseButton,
@ -27,4 +30,5 @@ export {
UserCenter, UserCenter,
Search, Search,
Reload, Reload,
TabBar,
}; };

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="h-60px text-2xl flex-center overflow-hidden cursor-pointer" @click="pushHome"> <div class="h-60px text-2xl flex-center overflow-hidden cursor-pointer" @click="toRoot()">
<SvgIcon name="logo" :size="28" /> <SvgIcon name="logo" :size="28" />
<span v-show="!appStore.collapsed" class="mx-4">{{ appStore.title }}</span> <span v-show="!appStore.collapsed" class="mx-4">{{ appStore.title }}</span>
</div> </div>
@ -9,10 +9,7 @@
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import { useAppRouter } from '@/hook'; import { useAppRouter } from '@/hook';
const appStore = useAppStore(); const appStore = useAppStore();
const { routerPush } = useAppRouter(); const { toRoot } = useAppRouter();
const pushHome = () => {
routerPush('/');
};
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -0,0 +1,7 @@
<template>
<div class="bg-#333 wh-full"></div>
</template>
<script setup lang="ts"></script>
<style scoped></style>

View File

@ -27,7 +27,7 @@ export async function createPermissionGuard(
// 有登录但是没有路由,初始化路由、侧边菜单等 // 有登录但是没有路由,初始化路由、侧边菜单等
await routeStore.initAuthRoute(); await routeStore.initAuthRoute();
// 动态路由加载完回到根路由 // 动态路由加载完回到根路由
next({ name: 'root' }); next({ name: 'appRoot' });
return false; return false;
} }
// 权限路由已经加载仍然未找到重定向到not-found // 权限路由已经加载仍然未找到重定向到not-found

View File

@ -8,7 +8,7 @@ const routes: RouteRecordRaw[] = [
{ {
path: '/', path: '/',
name: 'root', name: 'root',
redirect: '/test/test1', redirect: 'appRoot',
component: BasicLayout, component: BasicLayout,
children: [...constantRoutes], children: [...constantRoutes],
}, },

View File

@ -1,6 +1,6 @@
import { defineConfig, presetUno, presetAttributify, presetIcons } from 'unocss'; // https://github.com/unocss/unocss import { defineConfig, presetUno, presetAttributify, presetIcons } from 'unocss'; // https://github.com/unocss/unocss
export default defineConfig({ export default defineConfig({
presets: [presetUno(), presetAttributify(), presetIcons()], presets: [presetUno({ dark: 'class' }), presetAttributify(), presetIcons()],
shortcuts: { shortcuts: {
'wh-full': 'w-full h-full', 'wh-full': 'w-full h-full',
'flex-center': 'flex justify-center items-center', 'flex-center': 'flex justify-center items-center',