refactor(projects): 添加exportDefaults替换defineProps

This commit is contained in:
Soybean
2021-11-07 01:23:01 +08:00
committed by Soybean
parent 43b832bee0
commit e61ee32a88
42 changed files with 886 additions and 970 deletions

View File

@@ -38,11 +38,13 @@ import { menus } from '@/router';
import { GlobalMenuOption } from '@/interface';
import { GlobalLogo } from '../../../common';
defineProps({
zIndex: {
type: Number,
default: 0
}
interface Props {
/** 层级z-index */
zIndex?: number;
}
withDefaults(defineProps<Props>(), {
zIndex: 0
});
const theme = useThemeStore();

View File

@@ -17,30 +17,24 @@
<script setup lang="ts">
import { computed } from 'vue';
import type { PropType, VNodeChild } from 'vue';
import type { VNodeChild } from 'vue';
import { useBoolean } from '@/hooks';
const props = defineProps({
routeName: {
type: String,
required: true
},
label: {
type: String,
default: ''
},
icon: {
type: Function as PropType<() => VNodeChild>,
required: true
},
activeRouteName: {
type: String,
required: true
},
isMini: {
type: Boolean,
default: false
}
interface Props {
/** 路由名称 */
routeName: string;
/** 路由名称文本 */
label: string;
/** 路由图标 */
icon: VNodeChild;
/** 当前激活状态的理由名称 */
activeRouteName: string;
/** mini尺寸的路由 */
isMini?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
isMini: false
});
const { bool: isHover, setTrue, setFalse } = useBoolean();

View File

@@ -15,7 +15,7 @@
:style="{ width: showDrawer ? theme.menuStyle.width + 'px' : '0px' }"
>
<header class="header-height flex-y-center justify-between">
<h2 class="pl-8px text-16px g_text-primary font-bold">{{ title }}</h2>
<h2 class="g_text-primary pl-8px text-16px font-bold">{{ title }}</h2>
<div class="px-8px text-16px text-gray-600 cursor-pointer" @click="toggleFixedMixMenu">
<icon-mdi:pin-off v-if="app.menu.fixedMix" />
<icon-mdi:pin v-else />
@@ -39,15 +39,15 @@ import { useAppTitle } from '@/hooks';
import { menus } from '@/router';
import type { GlobalMenuOption } from '@/interface';
const props = defineProps({
visible: {
type: Boolean,
default: false
},
activeRouteName: {
type: String,
required: true
}
interface Props {
/** 菜单抽屉可见性 */
visible?: boolean;
/** 激活状态的路由名称 */
activeRouteName: string;
}
const props = withDefaults(defineProps<Props>(), {
visible: false
});
const router = useRouter();

View File

@@ -10,11 +10,13 @@ import { computed } from 'vue';
import { useThemeStore } from '@/store';
import { DefaultSider, VerticalMixSider } from './components';
const props = defineProps({
zIndex: {
type: Number,
default: 0
}
interface Props {
/** 层级z-index */
zIndex?: number;
}
const props = withDefaults(defineProps<Props>(), {
zIndex: 0
});
const theme = useThemeStore();