mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-26 16:46:19 +08:00
perf: enable strict ts type checking (#4045)
This commit is contained in:
@@ -71,7 +71,7 @@ async function generateRoutes(
|
||||
const firstChild = route.children[0];
|
||||
|
||||
// 如果子路由不是以/开头,则直接返回,这种情况需要计算全部父级的path才能得出正确的path,这里不做处理
|
||||
if (!firstChild.path || !firstChild.path.startsWith('/')) {
|
||||
if (!firstChild?.path || !firstChild.path.startsWith('/')) {
|
||||
return route;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { AuthenticationProps, LoginAndRegisterParams } from './typings';
|
||||
|
||||
import { useForwardPropsEmits } from '@vben/hooks';
|
||||
import {
|
||||
Dialog,
|
||||
@@ -10,7 +12,6 @@ import {
|
||||
} from '@vben-core/shadcn-ui';
|
||||
|
||||
import AuthenticationLogin from './login.vue';
|
||||
import { AuthenticationProps, LoginAndRegisterParams } from './typings';
|
||||
|
||||
interface Props extends AuthenticationProps {
|
||||
avatar?: string;
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { AuthenticationProps, LoginEmits } from './typings';
|
||||
|
||||
import { computed, reactive } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
@@ -12,7 +14,6 @@ import {
|
||||
|
||||
import Title from './auth-title.vue';
|
||||
import ThirdPartyLogin from './third-party-login.vue';
|
||||
import { AuthenticationProps, LoginEmits } from './typings';
|
||||
|
||||
interface Props extends AuthenticationProps {}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
});
|
||||
|
||||
const defaultValue = computed(() => {
|
||||
return props.tabs?.[0].value;
|
||||
return props.tabs?.[0]?.value;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MenuRecordRaw } from '@vben/types';
|
||||
|
||||
import { computed, watch } from 'vue';
|
||||
|
||||
import { useWatermark } from '@vben/hooks';
|
||||
@@ -9,7 +11,6 @@ import {
|
||||
usePreferences,
|
||||
} from '@vben/preferences';
|
||||
import { useLockStore, useUserStore } from '@vben/stores';
|
||||
import { MenuRecordRaw } from '@vben/types';
|
||||
import { mapTree } from '@vben/utils';
|
||||
import { VbenAdminLayout } from '@vben-core/layout-ui';
|
||||
import { Toaster, VbenBackTop, VbenLogo } from '@vben-core/shadcn-ui';
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MenuRecordRaw } from '@vben/types';
|
||||
import type { MenuProps } from '@vben-core/menu-ui';
|
||||
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { Menu, MenuProps } from '@vben-core/menu-ui';
|
||||
import { Menu } from '@vben-core/menu-ui';
|
||||
|
||||
import { useNavigation } from './use-navigation';
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MenuRecordRaw } from '@vben/types';
|
||||
import type { MenuProps } from '@vben-core/menu-ui';
|
||||
|
||||
import { Menu, MenuProps } from '@vben-core/menu-ui';
|
||||
import { Menu } from '@vben-core/menu-ui';
|
||||
|
||||
interface Props extends MenuProps {
|
||||
menus?: MenuRecordRaw[];
|
||||
|
@@ -49,7 +49,7 @@ function handleClose() {
|
||||
|
||||
const keys = useMagicKeys();
|
||||
const cmd = isWindowsOs() ? keys['ctrl+k'] : keys['cmd+k'];
|
||||
whenever(cmd, () => {
|
||||
whenever(cmd!, () => {
|
||||
if (props.enableShortcutKey) {
|
||||
open.value = true;
|
||||
}
|
||||
|
@@ -95,10 +95,12 @@ async function handleEnter() {
|
||||
return;
|
||||
}
|
||||
const to = result[index];
|
||||
searchHistory.value.push(to);
|
||||
handleClose();
|
||||
await nextTick();
|
||||
router.push(to.path);
|
||||
if (to) {
|
||||
searchHistory.value.push(to);
|
||||
handleClose();
|
||||
await nextTick();
|
||||
router.push(to.path);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrow key up
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import type { SelectOption } from '@vben/types';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { $t } from '@vben/locales';
|
||||
import { SelectOption } from '@vben/types';
|
||||
|
||||
import SelectItem from '../select-item.vue';
|
||||
import SwitchItem from '../switch-item.vue';
|
||||
|
@@ -126,19 +126,19 @@ function handleSubmitLogout() {
|
||||
|
||||
if (enableShortcutKey.value) {
|
||||
const keys = useMagicKeys();
|
||||
whenever(keys['Alt+KeyQ'], () => {
|
||||
whenever(keys['Alt+KeyQ']!, () => {
|
||||
if (enableLogoutShortcutKey.value) {
|
||||
handleLogout();
|
||||
}
|
||||
});
|
||||
|
||||
whenever(keys['Alt+Comma'], () => {
|
||||
whenever(keys['Alt+Comma']!, () => {
|
||||
if (enablePreferencesShortcutKey.value) {
|
||||
handleOpenPreference();
|
||||
}
|
||||
});
|
||||
|
||||
whenever(keys['Alt+KeyL'], () => {
|
||||
whenever(keys['Alt+KeyL']!, () => {
|
||||
if (enableLockScreenShortcutKey.value) {
|
||||
handleOpenLock();
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
import type {
|
||||
AxiosInstance,
|
||||
AxiosResponse,
|
||||
type InternalAxiosRequestConfig,
|
||||
InternalAxiosRequestConfig,
|
||||
} from 'axios';
|
||||
|
||||
const errorHandler = (res: Error) => Promise.reject(res);
|
||||
|
Reference in New Issue
Block a user