refactor(projects): 代码优化

This commit is contained in:
Soybean
2022-04-22 09:00:21 +08:00
parent 219f87f467
commit 5e276421ad
9 changed files with 59 additions and 68 deletions

View File

@ -8,6 +8,7 @@
</template>
<script setup lang="ts">
import { RouterLink } from 'vue-router';
import { routePath } from '@/router';
import { useAppInfo } from '@/composables';

View File

@ -49,9 +49,9 @@ const route = useRoute();
const app = useAppStore();
const theme = useThemeStore();
const { routerPush } = useRouterPush();
const { title } = useAppInfo();
const showDrawer = computed(() => (props.visible && props.menus.length) || app.mixSiderFixed);
const { title } = useAppInfo();
const activeKey = computed(() => route.name as string);
const expandedKeys = ref<string[]>([]);

View File

@ -3,7 +3,7 @@
type="primary"
:class="[{ '!right-330px': app.settingDrawerVisible }, app.settingDrawerVisible ? 'ease-out' : 'ease-in']"
class="fixed top-240px right-14px z-10000 w-42px h-42px !p-0 transition-all duration-300"
@click="app.toggleSettingdrawerVisible"
@click="app.toggleSettingDrawerVisible"
>
<icon-ant-design-close-outlined v-if="app.settingDrawerVisible" class="text-24px" />
<icon-ant-design-setting-outlined v-else class="text-24px" />

View File

@ -47,7 +47,7 @@ export const useAppStore = defineStore('app-store', {
this.settingDrawerVisible = false;
},
/** 切换抽屉可见状态 */
toggleSettingdrawerVisible() {
toggleSettingDrawerVisible() {
this.settingDrawerVisible = !this.settingDrawerVisible;
},
/** 设置侧边栏折叠状态 */

View File

@ -24,7 +24,7 @@ export function getLayoutComponent(layoutType: EnumType.LayoutComponentName) {
*/
export function getViewComponent(routeKey: AuthRoute.RouteKey) {
if (!views[routeKey]) {
consoleError(`路由“${routeKey}”没有对应的组件文件!`);
consoleError(`路由“${routeKey}”没有对应的组件文件!`);
}
return () => setViewComponentName(views[routeKey], routeKey) as Promise<Component>;
}

View File

@ -12,6 +12,7 @@
</template>
<script lang="ts" setup>
import { RouterLink } from 'vue-router';
import { routeName } from '@/router';
type ExceptionType = '403' | '404' | '500';