Skip to content

Commit

Permalink
refactor: 优化ts类型写法
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed Nov 4, 2022
1 parent 7530824 commit d901046
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"vite-plugin-compression": "^0.5.1",
"vite-svg-loader": "^3.4.0",
"vue-eslint-parser": "^9.0.3",
"vue-tsc": "^0.34.7",
"vue-tsc": "^1.0.9",
"xregexp": "^5.1.1"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ const props = defineProps({
default: true,
},
});
const emit = defineEmits(['update:modelValue', 'update:visible']);
const emit = defineEmits<{
(e:'update:modelValue',value:RouteLocationNormalized[]):void,
(e:'update:visible',value:boolean):void
}>();
const tags = ref([] as RouteLocationNormalized[]);
watch(
() => props.modelValue,
Expand Down
8 changes: 1 addition & 7 deletions src/layout/components/menu/components/menuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@
</template>

<script setup lang="ts" name="MenuItem">
import { PropType } from 'vue';
import { RouteRecordRaw } from 'vue-router';
const props = defineProps({
item: {
type: Object as PropType<RouteRecordRaw>,
required: true,
},
});
const props = defineProps<{item:RouteRecordRaw}>();
let onlyOneChild = ref<RouteRecordRaw>();
const hasOneShowingChild = (children = [] as RouteRecordRaw[], parent: RouteRecordRaw) => {
const showingChildren = children.filter((item) => item.meta && !item.meta.hideMenu);
Expand Down
8 changes: 4 additions & 4 deletions src/layout/components/page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import { MeKeepAliveProps } from '@/components/meKeepAlive';
import { settingConfig } from '@/config';
import { useRouteStore } from '@/store';
import { ComputedRef, PropType, TransitionProps } from 'vue';
const props = defineProps({
transition: Object as PropType<TransitionProps>,
});
import { ComputedRef, TransitionProps } from 'vue';
const props = defineProps<{
transition?:TransitionProps
}>();
const routeStore = useRouteStore();
let keepAliveProps: undefined | ComputedRef<MeKeepAliveProps>;
if (settingConfig.openKeepAlive) {
Expand Down

0 comments on commit d901046

Please sign in to comment.