优化使用propTypes

This commit is contained in:
ahao 2023-09-23 23:12:43 +08:00
parent 9abd941eb5
commit 24d04539c3

View File

@ -21,7 +21,7 @@
v-for="child in item.children" v-for="child in item.children"
:key="child.path" :key="child.path"
:is-nest="true" :is-nest="true"
:item="child as RouteOption" :item="child"
:base-path="resolvePath(child.path)" :base-path="resolvePath(child.path)"
class="nest-menu" class="nest-menu"
/> />
@ -34,15 +34,12 @@ import { isExternal } from '@/utils/validate'
import AppLink from './Link.vue' import AppLink from './Link.vue'
import { getNormalPath } from '@/utils/ruoyi' import { getNormalPath } from '@/utils/ruoyi'
import { RouteOption } from "vue-router"; import { RouteOption } from "vue-router";
import { PropType } from "vue";
import { propTypes } from "@/utils/propTypes"; import { propTypes } from "@/utils/propTypes";
import { object } from 'vue-types';
const props = defineProps({ const props = defineProps({
// route object // route object
item: { item: object<RouteOption>().isRequired,
type: Object as PropType<RouteOption>,
required: true
},
isNest: propTypes.bool.def(false), isNest: propTypes.bool.def(false),
basePath: propTypes.string.def('') basePath: propTypes.string.def('')
}) })